溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

php 9000端口沒(méi)有啟動(dòng)怎么解決

發(fā)布時(shí)間:2022-01-17 10:04:03 來(lái)源:億速云 閱讀:587 作者:iii 欄目:編程語(yǔ)言

本文小編為大家詳細(xì)介紹“php 9000端口沒(méi)有啟動(dòng)怎么解決”,內(nèi)容詳細(xì),步驟清晰,細(xì)節(jié)處理妥當(dāng),希望這篇“php 9000端口沒(méi)有啟動(dòng)怎么解決”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來(lái)學(xué)習(xí)新知識(shí)吧。

php 9000端口沒(méi)有啟動(dòng)的解決辦法:1、找到“php5/fpm/pool.d/www.conf”;2、將listen改為“127.0.0.1:9000”;3、將nginx改回用端口監(jiān)聽(tīng)的方式;4、重啟nginx和php-fpm即可。

php 9000端口沒(méi)有啟動(dòng)怎么解決

本文操作環(huán)境:ubuntu 16.04系統(tǒng)、PHP7.1版、DELL G3電腦

php-fpm啟動(dòng)以后,沒(méi)有出現(xiàn)9000端口?

最近在復(fù)現(xiàn)一個(gè)php擴(kuò)展的后門,需要搭建Nginx+php環(huán)境,nginx我是用源碼裸裝的,不帶任何第三方模塊。

php-cli和php-fpm 則是通過(guò)ubuntu的標(biāo)準(zhǔn)apt-get命令安裝的。

隨后需要修改nginx的nginx.conf文件讓其支持php腳本解析。

經(jīng)查詢網(wǎng)上的配置有兩種,一種是

支持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;
    }

剛開(kāi)始使用第一種9000端口的方式進(jìn)行配置,php解析不了,后經(jīng)過(guò)查詢php-fpm日志,發(fā)現(xiàn)有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文件交互的模式,發(fā)現(xiàn)還是頁(yè)面解析不了。

最后找到/etc/php5/fpm/pool.d/www.conf 配置文件,將listen改為127.0.0.1:9000

又將nginx改回用端口監(jiān)聽(tīng)的方式,重啟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端口沒(méi)有啟動(dòng)怎么解決

讀到這里,這篇“php 9000端口沒(méi)有啟動(dòng)怎么解決”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識(shí)點(diǎn)還需要大家自己動(dòng)手實(shí)踐使用過(guò)才能領(lǐng)會(huì),如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注億速云行業(yè)資訊頻道。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

php
AI