httpd.conf Can Override php.ini

httpd.conf and php.ini, which has priority? I have done some experiments, and the conclusions are –

  • php settings in php.ini can be overrided by httpd.conf (or some other Apache configuration files) with php_admin_value, php_admin_flag, php_value, and php_flag.
  • However, I find on Linux, if php_admin_value, php_admin_flag, php_value, or php_flag can not be put inside of VirtualHost block. They can be put inside of Directory block, but if Directory is inside of VirtualHost, they won’t work. I assume it is a php bug because on Windows php_admin_value, php_admin_flag, php_value, or php_flag can be inside of VirtualHost or Directory blocks.
  • Some of php directives can only be set by php_admin_value or php_admin_flag, for example, safe_mode. Others can be set by php_admin or php_(non_admin), for example, display_errors. But if display_errors is set by php_admin, it is not overridable by .htaccess; if display_errors is set by php_(non_admin), .htaccess can override it.

One Reply to “httpd.conf Can Override php.ini”

Leave a Reply

Your email address will not be published. Required fields are marked *