Apache2+php-cgi consume more CPU

Discussion in 'Installation/Configuration' started by Divya.p, Aug 23, 2022.

  1. Divya.p

    Divya.p New Member

    Hi,
    We have Ubuntu 20.04 and apach2 2.4.41 Linux server
    Recently facing issue regarding php-cgi consume more space in CPU so server went down frequently.
    How to find out which php file is culprit? and how to find out root cause this issue?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Are you really using php-cgi? I guess you probably use php-fcgi and not php-cgi as the name of processes is the same just that php-cgi requires way more resources. Check which setting you have chosen in the website settings and take care all your sites use either php-fcgi or php-fpm and PHP mode and not php-cgi (which has been disabled in current ISPConfig versions anyway).

    Then take a look at the process list with e.g. top command, PHP runs under a different user in each site (if you set it up correctly, means the suexec checkbox is ticked in each site). so when you see a lot of processes with e.g. user web2, then you know that they belong to the website with ID 2 on your system.
     
    Divya.p likes this.
  3. Divya.p

    Divya.p New Member

    Hi Till, Thanks for your quick reply

    yes i have using php-fcgi application for website. For me it's new to php-cgi i dont have pretty knowledge in php
    How can i found out root cause of this issue? for this issue my apache frequently reload and additionally when ever my CPU utilization high i got SIGKILL error from apache2 error.log
    Please guide me on this.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Then take a look at the process list with e.g. top command, PHP runs under a different user in each site (if you set it up correctly, means the suexec checkbox is ticked in each site). So when you see a lot of processes with e.g. user web2, then you know that they belong to the website with ID 2 on your system. Then you can further investigate this by looking at the eccess.log of the website. The root cause might be a malware infection of a site or a DOS attack against a site or something similar, or just higher traffic on your sites in general so that your server is too small now.

    if you don't know how Linux processes and PHP work, then it might be better that you ask a Linux admin to investigate that for you.
     

Share This Page