Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    4

    Unhappy 100% CPU PHP Process

    I have been facing this annoying problem and cannot find a solution. Some suggest that it is a hardware issue.

    This happens a few times in a day. We have suPHP installed and see some users in the server have a php process that is using 100% of CPU. The process is stuck and cannot be killed by "kill" or "kill -9". I can't check the process too because the "lsof -p PID" command freezes everytime I enter it. Then the server load keeps increasing and server crash in the end. The only way to stop this is making a force reboot.

    PHP 5.2.12
    cPanel 11.25.0-R43286
    MySQL 5.0.89

    We have exactly the same setup for other servers and do not have this problem.

    Can somebody suggest a way to fix it or at least try to locate the problem?

    Regards.

  2. #2
    cPanel Quality Assurance Analyst cPanelDon's Avatar
    Join Date
    Nov 2008
    Location
    Houston, Texas, U.S.A.
    Posts
    2,555
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default

    Quote Originally Posted by kokyew View Post
    I have been facing this annoying problem and cannot find a solution. Some suggest that it is a hardware issue.

    This happens a few times in a day. We have suPHP installed and see some users in the server have a php process that is using 100% of CPU. The process is stuck and cannot be killed by "kill" or "kill -9". I can't check the process too because the "lsof -p PID" command freezes everytime I enter it. Then the server load keeps increasing and server crash in the end. The only way to stop this is making a force reboot.

    PHP 5.2.12
    cPanel 11.25.0-R43286
    MySQL 5.0.89

    We have exactly the same setup for other servers and do not have this problem.

    Can somebody suggest a way to fix it or at least try to locate the problem?
    What is the PHP handler set to? I would consider switching the PHP handler to SuPHP so that the problematic process, if recurring, could be easily tracked to the specific account that executed the script. When using SuPHP it would be possible to view the process and the user that executed the script using CLI tools such as "ps" and "top" via root SSH access.

    The following command will display the PHP handler and SuExec status for PHP:
    Code:
    # /usr/local/cpanel/bin/rebuild_phpconf --current
    Here is an example of the output as seen on a test system using SuPHP with both PHP 5 and PHP 4 with SuExec enabled; the displayed information may differ depending on the system-specific configuration and also depending on what options were used in the EasyApache build profile:
    Code:
    # /usr/local/cpanel/bin/rebuild_phpconf --current
    Available handlers: suphp dso fcgi cgi none
    DEFAULT PHP: 5
    PHP4 SAPI: suphp
    PHP5 SAPI: suphp
    SUEXEC: enabled
    The following WHM menu path and documentation will help in regard to switching the PHP handler:
    WHM: Main >> Service Configuration >> Apache Configuration >> PHP and SuExec Configuration
    Configuring PHP and suEXEC from the Command Line
    Apache PHP Request Handling

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    4

    Default

    suPHP is already enabled. Everytime there are different accounts having a high CPU usage php process. So I think it's not a particular account problem.

    # /usr/local/cpanel/bin/rebuild_phpconf --current
    Available handlers: suphp dso cgi none
    DEFAULT PHP: 5
    PHP4 SAPI: suphp
    PHP5 SAPI: suphp
    SUEXEC: enabled
    There is nothing indicating the problem in the error log. We can't run "lsof", "strace" to check the process because the command will freeze everytime I run it.

    So weird....

  4. #4
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Default

    suPHP is already enabled. Everytime there are different accounts having a high CPU usage php process. So I think it's not a particular account problem.
    There is literally hundreds of different possible causes for PHP scripts using high CPU usage numbers and loading the server under your configuration but if I were to take a blind stab at it based on experience with only the information you have provided, I would say that some of your accounts have files or folders configured with 777 permissions and that is likely causing scripts to get stuck as I have seen that problem on many servers and when the permissions are corrected, the load issues often go away.

    The following command might help you check for this issue:
    Code:
    #  find /home/*/public_html -perm 777
    The following is usually the best permissions for files on
    SuPHP based hosting accounts:

    755 All Folders (Including ones authors tell you to set 777)

    755 All CGI Scripts (.cgi, .pl, .pm, .py, .e)

    600 All PHP Scripts

    400 PHP Configuration Scripts (configure.php)
    *** Basically those you don't want WRITABLE ***

    644 Most everything else (Images, Plain HTML, Templates, Etc)

    Again you could have some other underlying issue but the above would definitely be the first thing that I would take a look at before looking
    next to anything else especially without any other information in hand.

    The next item I would look at is how many hosting accounts you have, what the traffic looks like for each of those account, and what are the hardware and resource specifications for your server?

    Hope that helps

Similar Threads & Tags
Similar threads

  1. [php] <defunct> CPU Process
    By cool999 in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 10-24-2011, 06:56 AM
  2. nobody run 34 process.. 108% CPU by PHP loading and PHP5 [defunct]
    By asiansexynine in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-05-2010, 06:44 AM
  3. roundcube using 100% cpu
    By sehh in forum E-mail Discussions
    Replies: 2
    Last Post: 09-27-2009, 08:05 PM
  4. What is kswapd. It's using 100% of cpu
    By phantom2 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-08-2005, 07:04 PM
  5. neomail.pl uses near 100% cpu
    By Wako in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 09-14-2004, 05:42 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube