[英]Configure the PHP built-in web server
使用内置的PHP Web服务器时,如何设置配置选项,通常使用php.ini
或.htaccess
文件设置?
Simply add a custom configuration file to your project, and then run the built-in server with this flag: 只需将自定义配置文件添加到项目中,然后使用此标志运行内置服务器:
php -S localhost:8000 -c php.ini
This is especially helpful for settings that cannot be set at runtime using ini_set()
. 这对于使用
ini_set()
无法在运行时设置的设置特别有用。
php.ini
file: php.ini
文件: short_open_tag=On
You can also forgo the php.ini
file and add your configuration inline: 您也可以放弃
php.ini
文件并在线添加配置:
php -S localhost:8000 -c "short_open_tag=On" -t public/ server.php
i wouldnt add php.ini to your project. 我不会将php.ini添加到您的项目中。 what are you trying to do.
你想做什么。
i would leave the default php.ini alone and depending on your OS. 我将保留默认的php.ini,具体取决于您的操作系统。 i would create a php.d folder and put php.ini in there with additional configs.
我会创建一个php.d文件夹,并将php.ini放在那里与其他配置。 if you're making server level configs you can put the changes in your .htaccess file in your project root.
如果您正在进行服务器级别配置,则可以将更改放在项目根目录中的.htaccess文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.