How to best locate/manage multiple PHP.ini config files?

A quick locate php.ini results in this:


Needless to say this list is a bit overwhelming and is only going to get longer as I add servers.

Three questions:

  1. Which files are copied to new servers as they're created? I guess if I get these in order at the start, I'll have fewer modifications to make later.
  2. Is there some way to keep a root php.ini which controls all servers?
  3. What is the best practice for managing all this?

Thank you

I think that is better to have a root php.ini file for security reasons and performance…for me, clients don’t have to get too much access to that, they can ask to you for changes. Or you can use PHP-FPM to force some settings as root, and let your users controls the others settings, and either they edit php.ini, your PHP-FPM values will overwrite all that. But with PHP-FPM you wont have multiple php versions =(

For PHP-FPM you have to just setup your /etc/php-fpm.d/xxxxxxxx.conf these directives as example:

php_admin_value[session.save_path] = /home/codebr/tmp
php_admin_flag[allow_url_fopen] = Off

In PHP-FPM you have 4 ways to set PHP variables:

php_value[name] = value Don’t overwrite users php.ini file, just setup if they don’t.

php_flag[name] = on/off Don’t overwrite users php.ini file, just setup if they don’t.

php_admin_value[name] = value Overwrite users php.ini file.

php_admin_flag[name] = on/off Overwrite users php.ini file.

For a ROOT php.ini you should go to System settings -> Servers Template -> Default Settings -> PHP Options -> Allow editing of PHP configuration? -> No and in that same tab, have fields to manage where are your default template file for php.ini.

Hey thanks for this. I’m gonna go with a root php.ini for now and may branch off that later if needed. Cheers