Connect() to unix:/var/run/php5-fpm.sock failed

Posted on February 20, 2014 at 6:51 pm

This is an example error message found on error.log file:

2014/02/17 01:46:47 [crit] 35655#0: *12739 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: XX.XX.XX.XX, server: www.website.com, request: "GET /index HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.website.com", referrer: "http://www.website.com/index"

To fix this error message, I will just switch to use TCP/IP on PHP5-FPM.

Edit the pool file /etc/php5/fpm/pool.d/www.conf and change:

listen = /var/run/php5-fpm.sock

To this:

listen = 127.0.0.1:9000

Edit the Nginx vHost file and change:

        location ~ \.php$ {
            ...
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            ...
        }

To this:

        location ~ \.php$ {
            ...
            fastcgi_pass 127.0.0.1:9000;
            ...
        }

If you wrote the fastcgi_pass on /etc/nginx/fastcgi_params file, edit it too.

Restart PHP5-FPM service:

/etc/init.d/php5-fpm restart

Restart Nginx service:

/etc/init.d/nginx restart

Receive updates via email

Other Posts

Updated Posts