Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

php-fpm.sock failed (13 permission denied) – Fix it now

by | Apr 30, 2020

Are you seeing php-fpm.sock failed (13 permission denied) error in web server logs? We’ll help you fix it.

Often bad permissions or unavailability of the PHP-FPM handler results in these website errors.

Thus web server will not be able to communicate with the PHP FastCGI Process Manager or FPM.

At Bobcares, we resolve PHP-FPM errors as part of our Server Management Services.

Today, we’ll see how we resolve php-fpm.sock failed error and make websites working.


Where do we see php-fpm.sock failed (13 permission denied) error?

PHP FastCGI Process Manager (PHP-FPM) is a popular way of handling PHP pages. It allows a website to handle high loads. And, it works very well with high traffic websites too.

Usually, the php-fpm socket failure errors show up in the web server error logs as:

[crit] 4596#0: *138 connect() to unix:/tmp/php-fpm.sock failed (13: Permission denied) while connecting to upstream

On the website page, this would result in errors like 502 Bad Gateway or 503 Service Temporarily Unavailable.


Top causes for php-fpm.sock failed (13 permission denied) error

In general, PHP-FPM maintains a set of pools. These pools are workers available to respond to PHP requests. They will only execute PHP scripts as per the web server’s request. Finally, it sends the result back to the webserver. Thus, enabling PHP-FPM to service content will be quicker than usual methods.

However, when the webserver cannot communicate with the FPM handler, it eventually results in website errors.

Now, let’s see the top reasons for the PHP FPM socket failure.


Permission errors

One of the common reasons for the PHP FPM failure will be related permissions. When the permissions are wrong, the Apache or Nginx server will not be able to connect to the FPM daemon.

Recently, when a customer updated the PHP packages on his server, it reset the permissions of the files. The php-fpm socket was created with wrong ownership. Thus, the Nginx was not able to connect to the php-fpm socket.

The correct socket file permissions should be 0660

Often, extended access control lists also restrict access to the directory in which the socket lies. Thus, it makes php-fpm inaccessible for the web user.


Failed PHP-FPM service

Similarly, a failure in the PHP FPM service also can cause php-fpm.sock failed (13 permission denied) error.

In a cPanel server, a failed status of the cpanel_php_fpm status shows up as:

php-fpm sock failed 13 permission denied

This can be related to an incorrect php-fpm configuration or wrong server settings. Likewise, insufficient server memory can also prevent the start-up of php-fpm.


How we fix php-fpm.sock failed (13 permission denied) error

Moving on, let’s see how our Support Engineers fix the PHP FPM socket errors and make website working.


PHP-FPM status

We begin by checking the status of the FPM status. On a cPanel server, we check it by using the command:

service cpanel_php_fpm status

If it is not running, we simply restart it.

/scripts/restartsrv_cpanel_php_fpm --stop
/scripts/restartsrv_cpanel_php_fpm --start

Next, we check the error logs at /usr/local/cpanel/logs/php-fpm/error.log

It will show up any type of configuration errors. We correct these errors and make fpm running again. Here, we also check the memory usage of the server. Then add more memory in case of any resource constraints.


Correcting permissions of the socket

To fix the permissions of the socket file on an Nginx server, we did the following steps.

Edited the /etc/php-fpm.d/www.conf file and corrected these variables:

listen = /tmp/php7-fpm.sock
listen.owner = nginx = nginx

Here, the webserver was running under the user nginx. So we set the php-fpm user as nginx itself. Then, we saved the file and restarted PHP FPM

sudo service php7-fpm restart

This corrected the permissions on the socket file.

[[email protected]:~]ls -ahl /tmp/php7-fpm.sock
srw-rw---- 1 nginx nginx 0 Apr 6 08:08 /tmp/php7-fpm.sock

Finally, the website started working again.


[Need help to fix PHP FPM errors? We are available 24×7.]



In short, php-fpm.sock failed (13 permission denied) error happens due to incorrect PHP FPM configuration or service failure. Today, we saw how our Support Engineers fix the socket permissions and make the websites working.


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.


var google_conversion_label = "owonCMyG5nEQ0aD71QM";


Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center


Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]


Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid


Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie


These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.