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?

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>+

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) :slight_smile:

-Dustin

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.

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 :slight_smile:

Hope that helps,
-Dustin

That worked amazingly! Thanks a bunch!