Global php.ini with ini file per user/virtual server

Currently the php.ini file from "/etc/php5/cgi/php.ini" (or php template file if specified) is copied to the user directory (${HOME}/etc/php.ini) upon creating a virtual server.

Let's say we've got 50 virtual servers, when I want to change a PHP setting that applies to all virtual servers I would have to change 50 php.ini files! Is there a way I can use "/etc/php5/cgi/php.ini" as the default configuration and parse "${HOME}/etc/php.ini" as an additional php.ini file? This is actually how things work in for example Direct Admin. The "${HOME}/etc/php.ini" file can be used to overwrite the default settings from "/etc/php5/cgi/php.ini"

Status: 
Active

Comments

Howdy -- it's actually possible to make changes to all php.ini files using the command line. You can see the available options by running the command "virtualmin modify-php-ini".

Thanks! Not sure why I missed that in the documentation :)

Is it correct that there is no support for replacement variables such as ${HOME}?

Sure, similar to what we described in your post here, you can use replacement variables in the php.ini file template:

https://www.virtualmin.com/node/40261

Those would be interpolated to real values when a new Virtual Server is setup.

Sorry one more question :) When I run the following command (as root):

virtualmin modify-php-ini --all-domains --ini-name open_basedir --ini-value ${HOME}:/tmp

${HOME} is replaced to "/root" and ${DOM} doesn't seem to work. Is this a bug? How can I use the replacement values where the target domains belongs to, so I can effectively set open_basedir for all domains?

Category: Feature request » Bug report

Oh, sorry, you meant on the command line itself, not in the template. That makes more sense now :-)

That didn't click for me when you asked, my apologies.

I honestly haven't ever tried that before.

The problem you're seeing above, is that the shell is interpolating the ${HOME} before it gets to the "virtualmin" command.

What you may want to try, is to put the ${HOME} within ' characters on the command line you're using, like this:

virtualmin modify-php-ini --all-domains --ini-name open_basedir --ini-value '${HOME}:/tmp'

If that doesn't work, it's likely not supported on the command line.

Unfortunately running this:

virtualmin modify-php-ini --all-domains --ini-name open_basedir --ini-value '${HOME}:/tmp'

Results in this:

open_basedir = ${HOME}:/tmp

Too bad this is not supported. I hope someone is able to add this feature.

Category: Bug report » Feature request