Created
February 8, 2023 06:45
-
-
Save julienmru/144b35f83d81f7733e9f0ee1716148e8 to your computer and use it in GitHub Desktop.
Make cPanel's PHP-FPM max_children change persistent accross reboots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# License: MIT License | |
# Copyright (c) 2023 Julien Tessier, Hodi.host | |
# | |
# This script allows to have persistent change on cPanel's PHP-FPM limits | |
# (see https://support.cpanel.net/hc/en-us/articles/1500012339862-Server-reached-max-children-setting-25-consider-raising-it-cPanel-PHP-FPM-) | |
# | |
# Instructions: | |
# Backup files in /var/cpanel/php-fpm.d/ | |
# Edit the line 22 as required (and duplicate it if needed), in the example I set 250 max_children for user "hodi" | |
# Put this script in /usr/local/cpanel/libexec/on_boot/increase_cpanel_php_fpm_limit | |
# Make sure it's chmod'ed to be executable | |
# Reboot and see how the change is now persistent : ) | |
# First wait until cPanel's PHP-FPM has started (I don't know when cPanel overwrites the config) | |
until [ `ps ax | grep php-fpm.*/usr/local/cpanel/ | wc -l` -ge 2 ] | |
do | |
sleep 1 | |
done | |
# Then edit the max_children as needed (per user) | |
sed -i -e '/pm\.max_children =/ s/= .*/= 250/' /var/cpanel/php-fpm.d/hodi.conf | |
# Finally restart cPanel's PHP-FPM | |
/scripts/restartsrv_cpanel_php_fpm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment