Skip to main content

[CPANEL-19390] Restarting PHP-FPM service via command line fails

Comments

8 comments

  • thrive-ken
    Added screenshot from WHM
    0
  • cPanelMichael
    Hello @thrive-ken, A cron job to restart PHP-FPM isn't generally required as long as monitoring for PHP-FPM service for Apache is enabled in WHM >> Service Manager (it's enabled by default). That said, here's the command to use should you need to restart the service via the command line: /scripts/restartsrv_apache_php_fpm
    Both WHM >> Restart Services and the /scripts/restartsrv_apache_php_fpm command do the same thing. Are you able to reliably reproduce a different result between the two, or does it only happen sometimes? As to why that restart command is failing on your system, it looks to relate to the "Too many open files" error message you noted:
    Stopping php-fpm: [FAILED] Starting php-fpm: [01-Jun-2018 07:18:45] ERROR: failed to create new listening socket: socket(): Too many open files (24) [01-Jun-2018 07:18:46] ERROR: FPM initialization failed

    Do you host a high number of domain names on this server? If so, the following command will disable the system's open file limit for the Apache PHP-FPM service in CentOS 7: for drop in /etc/systemd/system/ea-php{54,55,56,70,71}-php-fpm.service.d; do mkdir -p $drop; printf '[Service]\nLimitNOFILE=infinity\n' > $drop/open_file_limit.conf; done
    Keep in mind you should monitor your system's resource usage upon disabling the limit to determine if it the open files limit should be reduced. Thank you.
    0
  • thrive-ken
    I'm reliably getting a different result running /scripts/restartsrv_apache_php_fpm vs WHM >> Restart Services everytime. I'm running Centos 6.9 - so no systemd. I tried bumping up the open file limits globally but that didn't change anything.
    0
  • cPanelMichael
    New I'm reliably getting a different result running /scripts/restartsrv_apache_php_fpm vs WHM >> Restart Services everytime.

    Can you open a
    0
  • thrive-ken
    Opened - Support ticket: 9666881.
    0
  • cPanelMichael
    Hello, To update, it looks like this relates to internal case CPANEL-19390, where running /scripts/restartsrv_apache_php_fpm can fail due to the an unavailable process ID for PHP-FPM. I'll monitor this case and update this thread again once the solution is published. In the meantime, the workaround is to restart the PHP-FPM service using WHM >> Restart Services >> PHP-FPM service for Apache. Thank you.
    0
  • cPanelMichael
    Hello, To update, the solution is published to cPanel & WHM version 72: Fixed case CPANEL-19390: Fix race condition in restartsrv_apache_php_fpm. Thank you.
    0
  • cPanelMichael
    Hello, For anyone using cPanel & WHM version 70, the case is now published to version 70.0.54. Thanks!
    0

Please sign in to leave a comment.