What should I do if the php 9000 port is not started?

藏色散人
Release: 2023-03-14 20:22:01
Original
10340 people have browsed it

Solution to PHP 9000 port not starting: 1. Find "php5/fpm/pool.d/www.conf"; 2. Change listen to "127.0.0.1:9000"; 3. Change nginx Change back to the port listening method; 4. Restart nginx and php-fpm.

What should I do if the php 9000 port is not started?

The operating environment of this article: ubuntu 16.04 system, PHP7.1 version, DELL G3 computer

What should I do if the php 9000 port is not started? ?After php-fpm is started, port 9000 does not appear?

Recently reproduced a php extension For the backdoor, you need to build an Nginx php environment. I installed nginx naked from source code without any third-party modules.

php-cli and php-fpm are installed through Ubuntu’s standard apt-get command.

Then you need to modify the nginx.conf file of nginx to support php script parsing.

After checking, there are two configurations on the Internet, one is

supports 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;
}
Copy after login

and the other is to use sock files

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;
    }
Copy after login

At the beginning, I used the first 9000 port configuration method, but PHP could not parse it. After checking the php-fpm log, I found that there was a 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
Copy after login

Then I switched to the second sock file interaction in the nginx configuration file. mode, it was found that the page still could not be parsed.

Finally found the /etc/php5/fpm/pool.d/www.conf configuration file and changed listen to 127.0.0.1:9000

Then changed nginx back to port listening. , after restarting nginx and php-fpm, you can finally parse the php script. .

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#
Copy after login

nginx.conf configuration file

 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;
        }
Copy after login

/etc/php5/fpm/pool.d/www.conf file modification place:

; 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
Copy after login

What should I do if the php 9000 port is not started?

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What should I do if the php 9000 port is not started?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template