php 9000埠沒有啟動的解決辦法:1、找到「php5/fpm/pool.d/www.conf」;2、將listen改為「127.0.0.1:9000」;3、將nginx改回用埠監聽的方式;4、重新啟動nginx和php-fpm即可。
本文操作環境:ubuntu 16.04系統、PHP7.1版、DELL G3電腦
php 9000埠沒有啟動怎麼辦?php-fpm啟動以後,沒有出現9000埠?
最近在復現一個php擴充套件的後門,需要搭建Nginx+php環境,nginx我是用原始碼裸裝的,不帶任何第三方模組。
php-cli和php-fpm 則是通過ubuntu的標準apt-get命令安裝的。
隨後需要修改nginx的nginx.conf檔案讓其支援php指令碼解析。
經查詢網上的設定有兩種,一種是
支援127.0.0.1:9000
location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name; include fastcgi_params; }
另一種是使用sock檔案
location ~ .php$ { root /usr/share/nginx/html; fastcgi_pass unix:/var/run/php-fpm/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
剛開始使用第一種9000埠的方式進行設定,php解析不了,後經過查詢php-fpm紀錄檔,發現有sock
[17-Sep-2019 00:23:02] NOTICE: fpm is running, pid 5617 [17-Sep-2019 00:23:02] NOTICE: ready to handle connections [17-Sep-2019 00:23:02] NOTICE: systemd monitor interval set to 10000ms [17-Sep-2019 00:31:28] ERROR: An another FPM instance seems to already listen on /var/run/php5-fpm.sock [17-Sep-2019 00:31:28] ERROR: FPM initialization failed [17-Sep-2019 00:37:34] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful
隨後在nginx組態檔中改用第二種sock檔案互動的模式,發現還是頁面解析不了。
最後找到/etc/php5/fpm/pool.d/www.conf 組態檔,將listen改為127.0.0.1:9000
又將nginx改回用埠監聽的方式,重新啟動nginx和php-fpm以後,終於可以解析php指令碼了。。
root@ubuntu:/usr/local/nginx# netstat -tln Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp6 0 0 ::1:631 :::* LISTEN root@ubuntu:/usr/local/nginx# pgrep nginx|xargs kill -s 9 root@ubuntu:/usr/local/nginx# vim conf/nginx.conf root@ubuntu:/usr/local/nginx# sbin/nginx root@ubuntu:/usr/local/nginx#
nginx.conf組態檔
server { listen 80; server_name localhost; root html; index index.php; location ~\.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
/etc/php5/fpm/pool.d/www.conf檔案修改的地方:
; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on ; a specific port; ; 'port' - to listen on a TCP socket to all addresses on a ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. listen = 127.0.0.1:9000
推薦學習:《》
以上就是php 9000埠沒有啟動怎麼辦的詳細內容,更多請關注TW511.COM其它相關文章!