search

Home  >  Q&A  >  body text

I have just built a website and the PHP-cgi program is occupying the CPU. How to solve it?

I just built the website and the PHP-cgi program is occupying the CPU. How to solve it


The server is stuck and cannot be moved. Looking for a solution

phpcn_u22234phpcn_u222342672 days ago1233

reply all(2)I'll reply

  • 清楚叛逆者

    清楚叛逆者2017-09-02 09:30:48

    1. Some PHP extensions have problems with compatibility with PHP versions. Practice has proved that eAccelerater has problems with certain PHP versions. The specific manifestation is that after starting the php-cgi process, it runs for more than 10 minutes and is extremely slow. However, access to static resources is very slow. Fast, and the server load is normal (which means there is no problem with nginx, but with the php-cgi process). The solution is to disable the eAccelerater module from php.ini and restart the php-cgi process

    2. There may be an infinite loop in the program, causing the server load to be extremely high (use the top command to check the load as high as 100+). You need to use the proc virtual file system of Linux to find the specific problem program

    3. PHP programs use sessions inappropriately. This It happened on the open source Weibo Note Dog program. The specific manifestation is that the CPU usage rate of a small number of php-cgi processes (no more than 10) reaches more than 98%, and the server load is between 4-8. Solving this problem still requires Find out why with the help of Linux's proc file system.

    Recommendation: Use the PHP version you develop on the server.

    reply
    1
  • Day

    Day2017-09-02 08:42:35

    Stop the server first, then restart it and check again

    reply
    1
  • Cancelreply