Home  >  Article  >  Backend Development  >  php-cgi.exe often crashes on its own, what is the reason?

php-cgi.exe often crashes on its own, what is the reason?

WBOY
WBOYOriginal
2016-09-14 09:41:251368browse

php-cgi.exe often crashes by itself, what is the reason? An nginx+php environment is built on this machine

Reply content:

php-cgi.exe often crashes by itself, what is the reason? An nginx+php environment is built on this machine

It’s time to post the error report... Otherwise, how will you know why it crashed?
Personally, I still recommend using the one-click package in a non-production environment. If something goes wrong, just restore it or install it in another way. It saves worry and effort (XD)

It is possible that the program itself is damaged, there may be a problem with the code, or you may have used some unstable php extensions. Or some anti-virus software accidentally kills this process.

After reading their source code, just add an environment variable:

php-cgi.exe often crashes on its own, what is the reason?

Although php-cgi supports resident background running, this mode of operation is unstable.
That’s why there are things like CGI process managers to solve this problem.
Let’s take the Apache/Nginx/IIS related functions below Explanation.
For example, the Apache FastCGI process manager module mod_fcgid has the function of managing and maintaining the number of PHP-CGI processes, while mod_proxy_fcgi is similar to Nginx fastcgi_pass, which means that Nginx is not responsible for managing the back-end CGI processes, Nginx only Responsible for the agent. PHP-FPM, which is often used with Nginx on Linux, can manage its own PHP-FPM sub-process (independent of the PHP-CGI process), so it is very stable. Microsoft has also developed a PHP-CGI process manager PHP for IIS Manager for IIS.

Finally summarize the common operating methods of PHP:

<code>Nginx fastcgi_pass      <=> PHP-FPM
Apache + mod_proxy_fcgi <=> PHP-FPM
Apache + mod_php        <=> libphp5.so/php5apache2_4.dll
Apache + mod_fcgid      <=> PHP-CGI
IIS + PHP Manager       <=> PHP-CGI</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn