Home  >  Article  >  Backend Development  >  Ubuntu环境下php fastcgi(spawn-fcgi)的启动与关闭

Ubuntu环境下php fastcgi(spawn-fcgi)的启动与关闭

WBOY
WBOYOriginal
2016-06-23 13:15:451391browse

启动

spawn-fcgi -a 127.0.0.1 -p 9000 -C 10 -u www-data -f /usr/bin/php-cgi  

说明:

-a 127.0.0.1: PHP FastCGI 绑定IP地址

-p 9000: PHP FastCGI 指定端口

-u www: PHP FastCGI 用户名

-g www: PHP FastCGI 用户组

-f /usr/local/bin/php-cgi: 指向 PHP5 fastcgi

权限不足sudo提权

查看运行状态

使用netstat配合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  

如果出现了这样的提示就说明fastcgi正在运行

如果想查看pid的话可以用 ps -ef

$ ps -ef | grep spawn-fcgiubuntu   27329 24796  0 02:50 pts/0    00:00:00 grep --color=auto spawn-fcgi  

退出

$pkill -9 php-cgi

这个操作很危险。 如果你使用的是nginx环境,中断fastcgi后前台访问php会提示502,很多人遇到502都是因为fastcgi忘打开或者异常退出引起的

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