[SOLVED] One php.ini for all virtual servers

6 posts / 0 new
Last post
#1 Fri, 09/12/2014 - 16:43
inteq

[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?

Fri, 09/12/2014 - 22:36
nibb

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

Sat, 09/13/2014 - 03:07
inteq

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?

Mon, 09/15/2014 - 10:00
andreychek

Howdy,

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.

-Eric

Mon, 09/15/2014 - 14:59
inteq

Thank you andreychek,

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

Sun, 10/19/2014 - 21:47
inteq

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

Topic locked