Question
Why am I seeing the following error in the Apache error_log?
[root@server ~]cPs# tailf /etc/apache2/logs/error_log
[Sun Jul 04 22:28:36.714856 2021] [proxy:error] [pid 2903] (13)Permission denied: AH02454: FCGI: attempt to connect to Unix domain socket /opt/cpanel/ea-php74/root/usr/var/run/php-fpm/0160604e06dcec41fcab4ee759f9083ea9dfce65.sock (*) failed
[Sun Jul 04 22:28:36.714927 2021] [proxy_fcgi:error] [pid 2903] [client 11.22.33.44:57826] AH01079: failed to make connection to backend: httpd-UDS
Answer
You are likely seeing a 503 error on your website and this error is being logged in the Apache error log as a result.
The error indicates that the PHP-FPM sock file has incorrect permissions or ownership.
To confirm this, you will want to list the contents of the /opt/cpanel/ea-php74/root/usr/var/run/php-fpm directory. In the output below you can see the sock file's owner is a number instead of the username. This indicates that the user ID isn't in use as the user was deleted.
[root@server ~]# ls -lah /opt/cpanel/ea-php74/root/usr/var/run/php-fpm
total 12K
drwx--x--x. 2 root root 4.0K Jul 4 15:54 .
drwxr-xr-x. 3 root root 4.0K Jul 4 09:45 ..
srw-rw----. 1 1000 nobody 0 Jul 4 15:50 abc123.sock
-rw-r--r--. 1 root root 4 Jul 4 15:54 php-fpm.pid
[root@server ~]# id 1000
id: 1000: no such user
To correct this you will need to move the sock file.
[root@server ~]# mv /opt/cpanel/ea-php74/root/usr/var/run/php-fpm/abc123.sock /root/
Then you can restart PHP-FPM to regenerate the sock file with the correct permissions.
[root@server ~]# /scripts/restartsrv_apache_php_fpm
apache_php_fpm restarted successfully.
Now you can see the sock file has a valid username.
[root@server ~]# ls -lah /opt/cpanel/ea-php74/root/usr/var/run/php-fpm
total 12K
drwx--x--x. 2 root root 4.0K Jul 4 15:54 .
drwxr-xr-x. 3 root root 4.0K Jul 4 09:45 ..
srw-rw----. 1 cpuser nobody 0 Jul 4 22:30 abc123.sock
-rw-r--r--. 1 root root 4 Jul 4 15:54 php-fpm.pid
Now your website should be able to load without issue.