[SOLVED] One php.ini for all virtual servers

It is possible to have one php.ini for all virtual servers instead of one file per server?

Yes, use DSO as PHP handler, and all accounts will use the default php.ini

I thought of that but security wise, is not the best practice.
DSO is fast and low on resources but not as secure as FCGI.
It has the “nobody” problem which makes it a PITA with WordPress (to name just one)

I was just looking to keep FCGI but still be able to edit php.ini for all virtual servers fast.
For example, tonight I had a problem with a domain which had a vulnerable php script sending massive spam.
To fix it fast, I needed to add to disable_functions the mail directive.
For one virtual server is ok.
But what if I want to make this change for all servers?


Using mod_php is the only supported way of sharing a single php.ini file.

As a quick way to make changes to all php.ini files though, you could always use Virtualmin’s CLI tools. This command can be used for changing a variable in all php.ini files (running it will show the available options):

virtualmin modify-php-ini

Also, PHP reads from a shared .conf directory. You can add directives designed to be shared into /etc/php5/conf.d/ on Ubuntu/Debian, and /etc/php.d/ on CentOS.


Thank you andreychek,

“virtualmin modify-php-ini” will suit my needs just fine.

For the record:

Changing a php.ini variable for all domains with Virtualmin CLI:

virtualmin modify-php-ini --all-domains --ini-name disable_functions --ini-value val1,val2,val3,etc