Submitted by banaan on Wed, 04/06/2016 - 04:32
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:
Closed (fixed)
Comments
Submitted by andreychek on Wed, 04/06/2016 - 09:13 Comment #1
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".
Submitted by banaan on Wed, 04/06/2016 - 14:56 Comment #2
Thanks! Not sure why I missed that in the documentation :)
Is it correct that there is no support for replacement variables such as ${HOME}?
Submitted by andreychek on Wed, 04/06/2016 - 15:10 Comment #3
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.
Submitted by banaan on Thu, 04/07/2016 - 02:11 Comment #4
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?
Submitted by banaan on Thu, 04/07/2016 - 03:59 Comment #5
Submitted by andreychek on Thu, 04/07/2016 - 10:05 Comment #6
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.
Submitted by banaan on Thu, 04/07/2016 - 11:22 Comment #7
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.
Submitted by banaan on Thu, 04/07/2016 - 11:23 Comment #8
Submitted by sinjab on Fri, 01/03/2020 - 04:14 Comment #9
This command will do what you want:
for u in $(virtualmin list-domains --user-only)
do
virtualmin modify-php-ini --user $u --ini-name open_basedir --ini-value ""/home/$u:/tmp""
done
Submitted by IssueBot on Fri, 01/17/2020 - 04:30 Comment #10
Automatically closed - issue fixed for 2 weeks with no activity.