The solution to the problem that the php cgi process does not exist: 1. Open the corresponding configuration file; 2. Keep the listen in php-fpm.conf consistent with the conf listen in nginx.conf or vhost.
The operating environment of this article: linux5.9.8 system, PHP5.6, Dell G3 computer.
Is there any php cgi process? PHP starts php-fpm successfully, but the php-cgi process cannot be found. 502 getaway?
Generally, after you have just installed the lnmp environment and changed the fastcgi_pass unix:/tmp/php-cgi.sock item in nginx to fastcgi_pass 127.0.0.1:9000, you will get a 502 error when accessing the web page. Page, the php-cgi process cannot be found using netstat -tlunp.
Solution:
1. LNMP uses unix sockets by default, and the fastcgi_pass parameter in the virtual host configuration file is unix:/tmp/php-cgi.sock;
Need to ensure that the settings in /usr/local/php/etc/php-fpm.conf
PHP 5.3 and above are listen = /tmp/php-cgi.sock
At the same time, fastcgi_pass unix:/tmp/php-cgi.sock; in the virtual host configuration below /usr/local/nginx/conf/nginx.conf and /usr/local/nginx/conf/vhost/ is inconsistent. Must be 502.
2. Sometimes 502 may appear in unix socket mode
You can try changing to tcp/ip
PHP 5.3 and above listen = /tmp/ Replace php-cgi.sock with listen = 127.0.0.1:9000, replace fastcgi_pass unix:/tmp/php-cgi.sock; in the nginx configuration file and virtual host configuration file with fastcgi_pass 127.0.0.1:9000; and then try restarting.
Summary:
/usr/local/php/etc/php-fpm.conf listen should be consistent with nginx.conf or conf listen in vhost
To be consistent with nginx configuration
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What to do if there is no php cgi process. For more information, please follow other related articles on the PHP Chinese website!