Php fpm address already in use

bind() to 0.0.0.0:80 failed (98: Address already in use) even though there is only NGINX running

NOTE: It turned out that there wasn’t any problem at all. See comment for detail. I’ve just got fresh instance from Oracle Cloud, Ubuntu 20.04 Minimized. Since I am trying to run DokuWiki on this instance, I’ve installed these packages:

sudo apt install net-tools lsof wget nano sudo apt install php7.4-fpm php7.4-xml php7.4-mbstring imagemagick nginx certbot python3-certbot-nginx 

I’ve never touched nginx.conf in /etc/nginx but deleted default symlink in /etc/sites-enabled and put my own conf file in /etc/nginx/conf.d with name example.com.conf (real name is redacted though)

server < listen 80 default_server; server_name example.com; root /var/www/dokuwiki; index index.php index.html; location / < try_files $uri $uri/ @dokuwiki; >location @dokuwiki < rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last; rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last; rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last; rewrite ^/(.*) /doku.php?id=$1&$args last; >location ~ \.php$ < include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; >location ~ /(conf|bin|inc|vendor)/ < deny all; >location ~ /data/ < internal; >> 
sudo chown -R www-data:www-data /var/www/dokuwiki 
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] still could not bind() 
root@redacted:~# lsof -i :80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nginx 1296 root 6u IPv4 32966 0t0 TCP *:http (LISTEN) nginx 1297 www-data 6u IPv4 32966 0t0 TCP *:http (LISTEN) nginx 1298 www-data 6u IPv4 32966 0t0 TCP *:http (LISTEN) root@redacted:~# systemctl status nginx ● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2021-11-06 13:24:23 UTC; 16min ago Docs: man:nginx(8) Process: 1294 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Process: 1295 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Main PID: 1296 (nginx) Tasks: 3 (limit: 1110) Memory: 3.1M CGroup: /system.slice/nginx.service ├─1296 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; ├─1297 nginx: worker process └─1298 nginx: worker process Nov 06 13:24:23 redacted systemd[1]: Starting A high performance web server and a reverse proxy server. Nov 06 13:24:23 redacted systemd[1]: Started A high performance web server and a reverse proxy server. root@redacted:~# fuser -v 80/tcp USER PID ACCESS COMMAND 80/tcp: root 1296 F. nginx www-data 1297 F. nginx www-data 1298 F. nginx 

Since I didn’t touched nginx.conf , nginx -t is saying that there is no error. but checking .conf file fails:

root@redacted:~# nginx -tc /etc/nginx/conf.d/example.com.conf nginx: [emerg] "server" directive is not allowed here in /etc/nginx/conf.d/example.com.conf:1 nginx: configuration file /etc/nginx/conf.d/example.com.conf test failed 

But I think this isn’t relevant of this problem (not sure though). Even kill all process using port 80 doesn’t work neither. I’ve searched google for solution of this problem, but haven’t found any working one. PS. I’ve opened port from iptables and OC web panel. So port thing won’t be the reason of this problem I think.

Читайте также:  Supermicro ipmi java certificate

Источник

Unable to start php-fpm on ubuntu 20.04

I am trying to start php8.1-fpm and i get the following error (while php8.0-fpm and php7.4-fpm start correctly). Any help would br greatly appreciated.

[root@ ~]# systemctl status php8.1-fpm.service ● php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2022-06-14 17:06:17 EEST; 5s ago Docs: man:php-fpm8.1(8) Process: 39682 ExecStart=/usr/sbin/php-fpm8.1 --nodaemonize --fpm-config /etc/php/8.1/fpm/php-fpm.conf (code=exited, status=78) Process: 39693 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/8.1/fpm/pool.d/www.conf 81 (code=exited, status=0/SUCCESS) Main PID: 39682 (code=exited, status=78) Jun 14 17:06:17 domain.com systemd[1]: Starting The PHP 8.1 FastCGI Process Manager. Jun 14 17:06:17 domain.com php-fpm8.1[39682]: [14-Jun-2022 17:06:17] ERROR: unable to bind listening socket for address 'localhost:8002': Address already in use (98) Jun 14 17:06:17 domain.com php-fpm8.1[39682]: [14-Jun-2022 17:06:17] ERROR: FPM initialization failed Jun 14 17:06:17 domain.com systemd[1]: php8.1-fpm.service: Main process exited, code=exited, status=78/CONFIG Jun 14 17:06:17 domain.com systemd[1]: php8.1-fpm.service: Failed with result 'exit-code'. Jun 14 17:06:17 domain.com systemd[1]: Failed to start The PHP 8.1 FastCGI Process Manager. 

1 Answer 1

It seems that you already have a process running on port 8002 in your localhost

identify the process with netstat -ltnp | grep -w ‘:8002’ and check if you can kill it or not

If another process need port 8002 you can change php-fpm port in file /etc/php/8.1/fpm/pool.d/www.conf

I just found out, after a reboot that now php8.0-fpm is not running now and php8.1-fpm is running OK. What the hell is that .

so you have to change listening port of one of two versions in something as /etc/php/8.1/fpm/pool.d/www.conf or /etc/php/8.0/fpm/pool.d/www.conf and restart all

Читайте также:  Заполнить массив через цикл python

It’s also easier to use sockets instead of ports like listen = /run/php/php8.0-fpm.sock and listen = /run/php/php8.1-fpm.sock . This does make you to use the sockets in the other configs like apache/nginx.

Источник

Solved Error : unable to bind listening socket for address ‘127.0.0.1:9000’ : address already in use.

I’m reinstalling Apache, PHP, MySQL and phpMyAdmin on my FreeBSD 13R-p8. The error that Im getting is the following :

Error : unable to bind listening socket for address ‘127.0.0.1:9000’ : address already in use.
Error : FPM initialization failed.

I think that it is due to a bad configuration of the module php-fpm. I have tried to reconfigure the conf file below from :

nano /usr/local/etc/php-fpm.d/www.conf listen = 127.0.0.1:9000 nano /usr/local/etc/php-fpm.d/www.conf.default listen = 127.0.0.1:9000
nano /usr/local/etc/php-fpm.d/www.conf listen = 0.0.0.0:9000 nano /usr/local/etc/php-fpm.d/www.conf.default listen = 0.0.0.0:9000

and I’ve opened port 9000 on my router,but it didn’t work. It means that I still see the error on the boot screen messages,even if php-fpm seems to work ok :

# service php-fpm status php_fpm is running as pid 5305.

sko

ziomario

Nyantastic

ziomario

ziomario

Check this. I don’t see any error if I stop and restart php-fpm when the system is running,but I see the error during the boot.

# service php-fpm stop Stopping php_fpm. Waiting for PIDS: 5305. # service php-fpm start Performing sanity check on php-fpm configuration: [02-Apr-2022 00:45:40] NOTICE: configuration file /usr/local/etc/php-fpm.conf test is successful Starting php_fpm. # netstat | grep 9000 NO OUTPUT HERE.

grahamperrin@

(Below that line, there’s a different error.)

kpedersen

That fpm port (9000) is not meant to be made public.

How it works is that Apache should be configured to not use the older CGI or mod_php plugins but instead use the fastcgi stuff. This works by offloading the .php processing to whatever fpm service is listening on that port.

If you make it public, anyone could run arbitrary malicious PHP script on your server, so do try to close that as soon as possible (and also only listen on 127.0.0.1:9000 instead).

Have a read through here and perhaps adapt it for your needs: https://dev.to/joetancy/php-fpm-with-apache2-2mk0

(Personally, unless you are dealing with seriously high volume (and so may need to compromise on security), you might want to consider standard cgi (i.e slowcgi). Separate processes for each php-cgi is actually a *feature* rather than a performance hindrance. Unless of course the php-fpm is (pre-)forked in which case you are probably OK)

Читайте также:  Set window properties in javascript

ziomario

I’ve found the reason of this error. It is that inside this folder : /usr/local/etc/rc.d/; there are a lot of *.pkgsave files. One of these,is : php-fpm.pkgsave ; I see that they are executable files, even if they don’t seem. I’ve removed every file of this type and all problems are gone.

Thanks

Reactions: vienuolis and grahamperrin@

Community platform by XenForo ® © 2010-2022 XenForo Ltd.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.

This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to bind listening socket for address ‘127.0.0.1:9000’: Address in use (98) #5

Unable to bind listening socket for address ‘127.0.0.1:9000’: Address in use (98) #5

Comments

I’ve created and run the docker using the following settings:

sudo docker run
—name=phlex
—restart=always
—detach=true
—net=host
-v /docker/containers/phlex/config:/config
-e PGID=1000 -e PUID=1000
-e TZ=»America/Los_Angeles»
-p 5666:5666 -p 5667:5667
digitalhigh/phlex

The docker starts without issue, but loading the web UI results in a 502 Bad Gateway error. Docker logs report a stream of the following:

[06-May-2017 19:53:05] ERROR: unable to bind listening socket for address ‘127.0.0.1:9000’: Address in use (98)
[06-May-2017 19:53:05] ERROR: FPM initialization failed

It seems this issue is a known issue, but I’m afraid I’m not quite sure how to address it as stated in this bug report:
abiosoft/caddy-docker#6

The text was updated successfully, but these errors were encountered:

Источник

Оцените статью