Startup and shutdown of phpfastcgi (spawn-fcgi) in Ubuntu
spawn-fcgi -a 127.0.0.1 -p 9000 -C 10 -u www-data -f /usr/bin/php-cgi
Note:
-A 127.0.0.1: PHP FastCGI binding IP address
-P 9000: PHP FastCGI specified port
-U www: PHP FastCGI user name
-G www: PHP FastCGI User Group
-F/usr/local/bin/php-cgi: Point to PHP5 fastcgi
Sudo privilege escalation
View running status
Use netstat with grep.
$ netstat -an |grep 9000tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:9000 127.0.0.1:58879 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:58880 TIME_WAIT
If this prompt appears, fastcgi is running.
If you want to view the pid, you can use ps-ef
$ ps -ef | grep spawn-fcgiubuntu 27329 24796 0 02:50 pts/0 00:00:00 grep --color=auto spawn-fcgi
Exit
$pkill -9 php-cgi
This operation is dangerous. If you are using the nginx environment, a 502 error will be prompted when you access php on the frontend after fastcgi is interrupted. many people encounter the 502 error because fastcgi forgot to open or unexpectedly exits.