Hello,
To improve the security we decided to add restriction on php to the domains home directory using open_basedir directive in php.ini.
Using the virtualmin API and the domains post modification script it seams to be easy. But there is moment that this won't work. We used bash script using modify-php-ini virtualmin command and using the variables from the after virtual server modification environment. Everything is find till you want to change the PHP version of already created virtual server (domain). Then the new php.ini is copied to the virtual server directory but without running the post modification script so the open_basedir isn't set.
It will come very useful to have an option to change php.ini directives in the process of copying the php.ini to the virtual servers directory with translating the environment variables like for example in the templates for BIND DNS records.
So we can set open_basedir like this ${HOME}:/usr/share/pear:/usr/share/php and when php.ini is copied to the virtual servers dir to be translated to /home/username:/usr/share/pear:/usr/share/php
Probably if the interface is like the "Server Templates">"Apache website">"Directives and settings for new websites" .
Comments
Submitted by andreychek on Tue, 06/09/2015 - 09:12 Comment #1
Howdy -- take a look at System Settings -> Server Templates -> Default -> Apache Website -> Template PHP 5 configuration file.
Using that, you can setup a custom php.ini template, including the use of variables in the template.
Would that do what you're looking for?
Submitted by george.asenov on Tue, 06/09/2015 - 09:43 Comment #2
Hello,
Yes probably this will help but did this translate the environment variables?
If it doesn't it won't help.
Submitted by andreychek on Tue, 06/09/2015 - 09:47 Comment #3
Yup -- check out the help text for that option, it details the variables that are supported.
Submitted by george.asenov on Wed, 06/10/2015 - 02:22 Comment #4
Hi Andreychek
Thank you very much Andreychek. I do know how I missed this option.