Edit all PHP Configuration Files

6 posts / 0 new
Last post
#1 Thu, 10/30/2014 - 23:42
tmiller91

Edit all PHP Configuration Files

How can I edit every virtual host PHP.ini files in one swoop? I had made changes to the global / template file via Webmin > Others > PHP Configuration and I just noticed it doesn't make the changes to existing virtual servers. I have about 75 virtual servers already setup that I want the config edited on. Any easy way to do this?

Fri, 10/31/2014 - 07:05
jimdunn

root# virtualmin list-php-ini

Shows PHP variables for some or all domains.

virtualmin list-php-ini --domain name | --user name | --all-domains
[--php-version number]
<--ini-name name>+ <--ini-value value>+
[--name-only]

root# virtualmin modify-php-ini

Changes PHP variables for some or all domains.

virtualmin modify-php-ini --domain name | --user name | --all-domains
[--php-version number]
<--ini-name name>+ <--ini-value value>+

Fri, 10/31/2014 - 11:46
ReArmedHalo

Using the Virtualmin command line api can do what your asking. See jimdunn's post for details. Specifically you will want the "virtualmin modify-php-ini" command.

Let us know if you need anymore help using the command (or any other questions in general) :)

-Dustin

Fri, 10/31/2014 - 12:58 (Reply to #3)
tmiller91

Thanks Dustin. I'm trying to follow along with what Jimdunn said above. How would I modify all domains's PHP maximum memory allocation from 32MB to 64MB, as well as the maximum file upload size from 2M to 8M.

Fri, 10/31/2014 - 13:12 (Reply to #4)
ReArmedHalo

I believe using the following commands:

virtualmin modify-php-ini --all-domains --ini-name memory_limit --ini-value 64M
virtualmin modify-php-ini --all-domains --ini-name upload_max_filesize --ini-value 8M
virtualmin modify-php-ini --all-domains --ini-name post_max_size --ini-value 8M

(You could do this in one line, but I wasn't 100% clear on the documentation in the syntax to do so)

I did not test these commands but I am fairly confident that I made no syntax errors. If I did, let me know and I can fix them :)

Hope that helps, -Dustin

Fri, 10/31/2014 - 16:53 (Reply to #5)
tmiller91

That worked amazingly! Thanks a bunch!

Topic locked