Upgrade-friendly override PHP settings

How (and where) would one go about customising PHP settings (as in “ini_set” statements)? I don’t really want to add them to the top of the root index.php file since this obviously will be overwritten on each upgrade…


OK, this seems to work… I’ve placed the directives at the top of the file config_override.php as follows:

Just below the opening <php on the first line:

ini_set('error_reporting', E_ALL & ~(E_STRICT|E_NOTICE));
ini_set("log_errors", 1);
ini_set("error_log", "path_to_your_error_log_file");

seems to pick up fine.

I normally do this kind of setting by changing php.ini directly.

Is there any advantage in doing it this way instead?

I have a multi-site environment that uses php.ini files for an application pool that serves several hosts on an internal server. By doing it this way, it becomes site-specific and doesn’t touch the behaviour of others, which also means I can dynamically tweak the settings for the site as I need them.

1 Like