使用增量配置启动 PHP


Starting PHP With Incremental Configuration

假设我想使用默认php.ini以及几个.php文件所需的设置:

error_reporting = E_ALL
display_errors = On
display_startup_errors = On

我知道-c参数,但这似乎期望一个完整的php.ini.我想要的是告诉 PHP 使用默认php.ini和如上所述的小配置文件,它会覆盖 php.ini 中的设置。

我该怎么做?

编辑:
对上下文的事情感到抱歉:它应该是 shebang 那种风格:

#!/usr/bin/php -cphp-with-errors.ini

问题是我只能向 PHP 添加一个参数,即一堆-d不起作用。

php可执行文件为此目的

接受 -d 参数:

$ php -d error_reporting=32767 -d display_errors=On file.php

在 Web 服务器的上下文中,您可以在 htaccess 文件中使用 php_valuephp_flag。请参阅 http://php.net/manual/en/configuration.changes.php。