Home>Article>Backend Development> What should I do if the php 9000 port is not started?
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.
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; }
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; }
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
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#
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; }
/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
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!