Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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

Discussion in 'General Discussion' started by thrive-ken, Jun 1, 2018.

Tags:
  1. thrive-ken

    thrive-ken Registered

    Joined:
    Jun 1, 2018
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Nowhere
    cPanel Access Level:
    Root Administrator
    We've had issues with php-fpm becoming unresponsive in the past and have had to restart it. I'm trying to put a cron entry in place to restart php-fpm daily. My issue is that the service does not come back up from a stop:

    # /etc/init.d/ea-php70-php-fpm restart
    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
    [FAILED]

    # /scripts/restartsrv_apache_php_fpm
    PHP-FPM Version 70 failed to start

    However, when I go into WHM and restart the service there it works fine:

    [Link Removed By Moderator - Please attach images directly to threads as attachments]

    What is WHM/Cpanel doing differently that is successfully restarting the service?
     
    #1 thrive-ken, Jun 1, 2018
    Last edited by a moderator: Jun 1, 2018
  2. thrive-ken

    thrive-ken Registered

    Joined:
    Jun 1, 2018
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Nowhere
    cPanel Access Level:
    Root Administrator
    Added screenshot from WHM
     

    Attached Files:

  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,672
    Likes Received:
    1,788
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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:

    Code:
    /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:

    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:

    Code:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. thrive-ken

    thrive-ken Registered

    Joined:
    Jun 1, 2018
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Nowhere
    cPanel Access Level:
    Root Administrator
    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.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,672
    Likes Received:
    1,788
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Can you open a support ticket so we can take a closer look at the affected system? You can post the ticket number here and I'll link this thread to the ticket.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. thrive-ken

    thrive-ken Registered

    Joined:
    Jun 1, 2018
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Nowhere
    cPanel Access Level:
    Root Administrator
    Opened - Support ticket: 9666881.
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,672
    Likes Received:
    1,788
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice