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.

How to manage runaway PHP procs for a site?

Discussion in 'Workarounds and Optimization' started by ylluminate, Dec 28, 2013.

  1. ylluminate

    ylluminate Member

    Joined:
    Apr 12, 2013
    Messages:
    13
    Likes Received:
    1
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I have a particular site that is being a real hassle. They're running WordPress, but php processes seem to be spawning to the point of being far beyond any other sites on the system. I frequently find them chewing away on 16-20 of the processor cores at 100% levels for each and I am also experiencing `-bash: fork: retry: Resource temporarily unavailable` when I ssh in as the user. Root and other users seem okay, except for the sluggishness of the system being chewed up by this user.

    What should I do to manage situations like this better? I have contemplated killing php procs with a cronjob to just look for php procs > 1 hour. I have also considered adjusting the ulimit for this user as well... but I am just not sure what the "best" approach to take may be for this scenario, especially given perhaps preferred cPanel options if there are any.
     
  2. ylluminate

    ylluminate Member

    Joined:
    Apr 12, 2013
    Messages:
    13
    Likes Received:
    1
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    FYI, here is a script that I wrote to kill php processes (I have it set to kill them all with pid runtime > 1, but that can be adjusted to 3600 for an hour; and you would want to replace USERNAME with a desired username there): /https://gist.github.com/996c8ab0609811425457

    This doesn't seem to resolve the performance problem though for the site and a slew more php processes appear to spawn fairly rapidly again for this WordPress site.
     
  3. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    569
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Most likely this user has a plugin that is resource intensive. I would advise him to disable all plugins, and enable one at a time until you find the cause of the problem.
     
  4. ThinIce

    ThinIce Well-Known Member

    Joined:
    Apr 27, 2006
    Messages:
    346
    Likes Received:
    7
    Trophy Points:
    18
    Location:
    Disillusioned in England
    cPanel Access Level:
    Root Administrator
    In my experience, this isoften either a site in need of a caching plugin (i.e. wp_supercache or similar) or a site being scanned by a vulnerability finding tool. I'd suggest taking a look at the apache log for the site, this may indicate what's happening (the latter case will for example have lots of requests to plugin files that aren't actually installed).
     
Loading...

Share This Page