Bulk Editing PHP-FPM .yaml Files on a cPanel Server

JeffTechnical Articles & Notes

When running all or most of ones client accounts on a cPanel server under PHP-FPM, making a change to PHP.INI in the usual ways has no effect. WHM Multi-PHP INI Editor does not work in the ‘normal’ way and nor do individual users’ cPanel account INI editors; in fact the way to make changes is (at time of writing) to manually edit .yaml type files in the directory for each user in the userdata folder here:


Then run the following command as root, at the command line:

/scripts/php_fpm_config --rebuild

And then restart the PHP-FPM service for Apache. This is most easily done in the WHM interface under “Restart Services”.

This is not only incredibly tedious, but also can very easily lead to Apache being unable to run because a single syntactically incorrect line in any one .yaml file can render Apache inoperable.

To remedy this, I’ve written a small PHP script which can (relatively) safely make bulk changes to all or some of the users on a cPanel server. The script is available on GitHub under the GNU General Public License version 3 at the link below:


Note that by default the script runs with $LIVE = false so you can test out your changes first.

Note also that you absolutely must ensure that the names and values of any new content you add is syntactically correct before proceeding to run in $LIVE mode.

If you make use of this script and it helps you, or if you find or fix a bug, please do get in touch, submit a comment or a pull request, on GitHib.

Next step for this project is to package it up and create an interface so it can be distributed as a cPanel WHM plugin.