Error - php7.0-fpm.sock failed [NGINX - Ubuntu Server]

September 5, 2018 4.9k views
Nginx PHP

Respected,
I’m facing php7.0-fpm.sock failed error from a long time on Ubuntu 16.04.5 LTS (NGINX). Six websites are active on this server.

Kindly check below detailed logs.

php7.0-fpm.log:

2018/09/04 06:25:04 [error] 18209#18209: *362673 connect() to unix:/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 162.158.126.43, server: [domainnamehidden].com, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “[domainnamehidden].com”

error.log:

[02-Sep-2018 06:25:02] NOTICE: error log file re-opened
[04-Sep-2018 09:19:40] NOTICE: Terminating …
[04-Sep-2018 09:19:41] NOTICE: exiting, bye-bye!
[04-Sep-2018 09:19:57] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful
[04-Sep-2018 09:19:57] NOTICE: fpm is running, pid 1745
[04-Sep-2018 09:19:57] NOTICE: ready to handle connections
[04-Sep-2018 09:19:57] NOTICE: systemd monitor interval set to 10000ms
[04-Sep-2018 19:53:56] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

If reboot the server then websites are working for a limited period (Approximately 5-7 hours). Another fix, I need to restart the PHP FPM through the following command: sudo service php7.0-fpm restart

Please help. Thank you!

1 comment
  • I had this same problem and seemed to have fixed it.

    Details:

    • Running
      • Ubuntu 19.04
      • php7.2
    • Checked the status of both nginx and php-fpm. Both were running fine.
    • error log was throwing a “502 Bad Gateway”

    Like chinmayrajyaguru, I changed unix:/run/php/php7.0-fpm.sock to unix:/var/run/php/php7.0-fpm.sock. However, I changed /etc/php/7.2/fpm/pool.d/www.conf.

    Upon doing that (and without restarting nginx or php-fpm), I refreshed the page which was displaying the 502 error and it immediately went back to normal.

    To the best of my knowledge, you need to make sure the unix socket path is the same in your nginx site config and the php-fpm pool config.

    Hope this helps anyone with this issue. I will post again if this isn’t a permanent fix.

1 Answer

I have changed root from unix:/run/php/php7.0-fpm.sock to unix:/var/run/php/php7.0-fpm.sock in Nginx Conf and Sites-available files for the testing purpose. I’ll update soon if the error appears again.

Have another answer? Share your knowledge.