custom php.ini / php_value : which takes precedence?
Asked Answered
G

1

5

We could override the default php.ini settings using the

PHPINIDir /var/www/web1

directive in <VirtualHost> decription.

But I have seen php_value statements which is applied to all the sites in the httpd.conf files. For example :

php_value upload_max_filesize somevalue

Will the general settings like above override the custom php.ini settings?

Pardon me that I don't have an environment to test this out at present.

Gauguin answered 26/11, 2015 at 8:2 Comment(1)
changed the title to custom php.iniGauguin
F
7

PHP configuration precedence order is as follows:

  1. The php.ini
  2. The conf.d directory. On some distros, there is a modularized conf.d directory. values specified in there override php.ini
  3. The directive PHPINIDir /var/www/web1 replaces 1 and 2 with your custom php.ini
  4. Apache virtual host configuration. e.g. "php_value error_reporting " overrides any php.ini
  5. .htaccess files placed inside your webspace override the above configuration
  6. Source code values specified in the source code override all other configuration

Some (security critical) options can only be set in higher level config files

Fredela answered 26/11, 2015 at 8:12 Comment(3)
Cheers mate !! nicely summarized .Gauguin
First, the link is broken. I get a blank page when I click it. Second, could you cite relevant documentation for your assertion here: "Configuration options 5 and 6 may be disabled in php.ini" -- How do I do this?Cockcroft
@Cockcroft I fixed the link - I did not find a very good replacement, though.Fredela

© 2022 - 2024 — McMap. All rights reserved.