問題タブ [php-builtin-server]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
php - $_SERVER['SCRIPT_NAME'] は、PHP 組み込みサーバーと Symfony 2 で任意のパスを要求する場合の /index.html です。
パスにピリオド (/whatever-something/a-page など) が含まれていない場合、$_SERVER
変数SCRIPT_NAME
がルート フォルダーに存在する場合は index.html または index.php に置き換えられるという奇妙な動作があります。SCRIPT_NAME
正しい値: /whatever.something/a-page (ルート フォルダーに index.html または index.php がない場合)。
Symfony が提供する router_dev.php の SCRIPT_NAME の値を確認します。
次のようにサーバーを実行します。app/console server:run
例 1 - 良い
例 2 - 良い
例 3 - 変!
これにより、基本的にピリオドを含まないすべてのリクエストでアプリが index.html を提供します。
一体何が起こっているのか誰か教えてくれませんか?
php - PHPビルトインサーバー - APPLICATION_ENVを$_SERVERに設定する方法
Zend Framework 2 と PHP 組み込みサーバーを使用しています。
Zend のドキュメントには次のように書かれています。
オプションで、Apache を使用する場合、VirtualHost で APPLICATION_ENV 設定を使用して、PHP がすべてのエラーをブラウザーに出力できるようにすることができます。これは、アプリケーションの開発中に役立ちます。
自分のマシンで「php-built-in-server」を実行したときに、すべてのエラーを表示できるようにしたいと考えています。
しかし$_SERVER['APPLICATION_ENV'] = 'development'
、最初に設定するindex.php
と、パブリック (開発) GIT リモートと (デプロイ) プライベート リモートで作業するのが難しくなる可能性があります。何かをコミットする必要がある$_SERVER['APPLICATION_ENV']
たびに、各コミットで環境ごとに変更する必要があります。
$_SERVER[]
実際のコードに影響を与えずに変数を設定する方法はありますか?
php - PHP 組み込み Web サーバーから shell_exec を使用してバックグラウンド プロセスを実行する
shell_exec()
PHP 組み込み Web サーバーは、バックグラウンド プロセスを適切に処理していないようです。でバックグラウンドに明示的に配置されていても、バックグラウンド プロセスが完了するまでリクエストはハングし&
ます。
例:
次に、別のシェルで:
これは起こるべきではありませんし、実稼働グレードの Web サーバーを使用している場合は実際には起こりません。それを回避する方法はありますか?
(注: これはフラッシュの問題ではありません。flush()
最初のエコーの後に追加しても発生せず、バックグラウンド プロセスが完了するまでリクエストはハングします。)
php - Windows PHP 5.6 built in server SQLite3
I have PHP 5.6 installed on windows 7 and I used the built in server to run websites locally for testing. I want to connect to a Sqlite3 file and I've uncommented the appropriate lines in the php.ini file in my C:\Program Files\php folder. I still get this error when trying to view the page on my local server:
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\Users\USERX\Documents\pageloadbasic.php:13 Stack trace: #0
C:\Users\USERX\Documents\pageloadbasic.php(13): PDO->__construct('sqlite:db/lhblo...') #1 {main} thrown in C:\Users\USERX\Documents\pageloadbasic.php on line 13
Why do I get this error?
A couple of notes: my phpinfo file shows:
Configuration File (php.ini) Path C:\Windows
(for some reason this always defaults to C:\Windows even if there is not php.ini file in there)
Loaded Configuration File C:\Program Files\php\php.ini
But there is no php.ini file in C:\Windows. Also, my php folder does not include a php_pdo.dll in the ext folder, but I added one that I extracted from the pecl-5.0.5-Win32 archive as instructed in some other sites.
I added extension=php_pdo.dll
in my php.ini file.
I uncommented extension=php_pdo_sqlite.dll
.
I uncommented extension=php_sqlite3.dll
.
I have these two lines in my php.ini which related to sqlite:
[sqlite]
; http://php.net/sqlite.assoc-case
;sqlite.assoc_case = 0
(I did not change anything on these two lines because I'm not sure what it is for...)
[sqlite3]
sqlite3.extension_dir = "ext"
(on this line I added the "ext" directory as suggested on another post)
I have this in my php code to connect to my db file using pdo:
$db = new PDO('sqlite:db/xxxxx.db');
What am I missing? What do I need to do to get PDO to work with Sqlite3?