The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Websites unresponsive after 2-3 Hours?

Discussion in 'General Discussion' started by razorif, Jan 20, 2016.

  1. razorif

    razorif Member

    Joined:
    Jun 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi Guys!

    I recently ran into a problem that is very annoying:

    I own a dedicated server with the specs below in this thread, I installed cPanel/WHM and didn't install or modify anything server based (only some normal easyapache configs)

    The problem is:
    -All my PHP websites are unresponsive after around 2-3 hours of restarting Apache (again).
    -Sometimes the problem gets solved instantly when I kill some random processes from the process manager in WHM.
    -When checking the average load of server it doesn't go past 20% CPU and 10% RAM.
    -The websites keep loading for long and become almost unresponsive.

    Dedicated server specs:

    Intel Xeon E-1520
    32GB of RAM
    1TB of HDD
    cPanel/WHM latest version
    EasyApache 3
    PHP 5.6
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  3. razorif

    razorif Member

    Joined:
    Jun 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thanks for your reply,

    After checking the cpanel error_log, I didn't find anything that is suspicious because the problems happens around 4-5 times a day and when looking through the log the only thing I found that is repeating is "[cpanel] Quotas are not enabled"...
    Also there's only 1 line (just 1) that says "Out of Memory!"
     
  4. razorif

    razorif Member

    Joined:
    Jun 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    UPDATE: Checking httpd.conf I found something that MIGHT be the issue's origin:
    RLimitMEM 2836398080
    RLimitCPU 240
    Searching on Google about both directives, those are RAM and CPU limiters for any httpd process (as well as child forked processes).

    The memory limit directive is set to 2705MB and I have 32GB ram available. For the CPU limit, I didn't understand what 240 is exactly.

    Should I expand the RLimitMEM? or leave it like that?
     
  5. razorif

    razorif Member

    Joined:
    Jun 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I've removed those lines from the httpd conf file, but it still the same after a day of testing.
    I am now even getting httpd FAILED monitoring emails, and it's not auto recovering...

    Do you think there's something that is related the monitoring service? Maybe it's not able to restart the service when it's crashing?
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,472
    Likes Received:
    200
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    What configs did you modify, exactly?
     
  7. razorif

    razorif Member

    Joined:
    Jun 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Nothing special, just added some extensions from the exhaustive list (like mbstring...) and rebuilt apache.
    But I didn't touch the httpd.conf file
     
  8. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,472
    Likes Received:
    200
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You could try selecting a "Basic Apache" profile in EasyApache, not change anything, and see if it builds and works properly. To troubleshoot.
     
  9. razorif

    razorif Member

    Joined:
    Jun 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I tried that already with many different modes (changing php version, apache basic profile...) still the same problem.
    By analyzing the apache error_log I found something repeating (same time when the down time happens):
    "[mpm_prefork:warn] [pid 13398] AH00167: long lost child came home! (pid 27478)"

    What does that line mean? Could it be the problem?
     
  10. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,472
    Likes Received:
    200
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Please feel free to open a ticket to cPanel Technical Support directly about this.
     
  11. razorif

    razorif Member

    Joined:
    Jun 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    RESOLVED:
    If anyone is reading this and looking for how I solved this issue, here's what I did (thanks to cPanel Support):

    -I changed the Apache config like below:

    Start servers: 25
    Minimum Spare Servers: 5
    Maximum Spare Servers : 10
    Server Limit: 1024
    Max request workers (IMPORTANT): 1024
    Max connections per child: 10000


    Again, do this if only your primary website(s) are heavily loaded with traffic and php requests. Also only if you have enough RAM on installed on your server (for instance me I have 32GB, but I think the above config would work normally on even 6GB).

    -I also changed the PHP handler to Fcgi (fastcgi) because I have traffic heavy websites.
    -I changed the MPM from prefork to worker, as it helps reducing the Memory usage for php scripts and it is advised to use this MPM for heavy loaded websites (you can do this by going to Software->Apache 3->Customize and there from the exhaustive list option disable MPM Prefork and enable MPM Worker).

    -After all of the above, be sure to recompile the Apache and better reboot the server (so every single process would be killed for real).

    Now I have never encountered this problem again and apache is functioning since that time and never got a httpd crash or down time.
     
  12. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page