如何查看当前pm.max_children配置值?配置修改后未生效问题排查
pm.max_children Value for PHP-FPM Let’s break down how to verify the active pm.max_children value for your PHP-FPM instance, plus a quick note on why your change might not have taken effect yet:
1. Use phpinfo() to See Runtime Configuration
Create a temporary PHP file (e.g., info.php) in your web server’s document root with this content:
<?php phpinfo(); ?>
Access this file via your browser (like http://your-domain/info.php), then use your browser’s search function to look for pm.max_children. You’ll find it under the PHP-FPM section—make sure to check the entry for your "www" pool specifically.
⚠️ Critical: Delete this file right after checking. Exposing phpinfo() publicly is a serious security risk.
2. Check via PHP-FPM’s Command Line Tools
For PHP 7.0 FPM, run these commands directly on your server terminal:
- To test and print the parsed configuration (including pool settings):
Scan the output forphp-fpm7.0 -ttpm.max_childrenunder the[pool www]block. This shows the value PHP-FPM will use with your current config files. - To fetch runtime info similar to
phpinfo()via CLI:php-fpm7.0 -i | grep "pm.max_children"
3. Inspect Running PHP-FPM Processes
To confirm the configuration loaded by the active PHP-FPM daemon:
- Get the main PHP-FPM process ID:
pidof php-fpm7.0 - View its command line arguments to verify which config file it’s using:
Look for acat /proc/$(pidof php-fpm7.0)/cmdline | tr '\0' ' '--fpm-configflag or the default path (/etc/php/7.0/fpm/php-fpm.conf, which includes pool configs likewww.conf).
A Quick Fix for Your Original Issue
Wait—you mentioned restarting Apache after modifying www.conf, but PHP-FPM is a separate service from Apache. Changes to PHP-FPM configs require restarting the PHP-FPM service itself, not Apache. Try this command to apply your change:
sudo systemctl restart php7.0-fpm # Or if using init.d: sudo service php7.0-fpm restart
That’s likely why your pm.max_children update didn’t take effect initially!
内容的提问来源于stack exchange,提问作者Tilman




