使用增量配置启动 PHP

Starting PHP With Incremental Configuration

假设我想使用默认 php.ini 加上我需要的几个设置。php-files:

error_reporting = E_ALL
display_errors = On
display_startup_errors = On

我知道 -c 参数,但似乎需要一个完整的 php.ini。我想要的是告诉 PHP 使用默认的 php.ini 和一个像上面那样的小配置文件,它会覆盖 php.ini.

中的设置

我该怎么做?

编辑:
对不起上下文的事情:它应该是 shebang-kind 的风格:

#!/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