cPanel - Permission denied: mod_fcgid: couldn't bind unix domain socket


After you change PHP 5 Handler to fcgi mode in cPanel,

Home » Service Configuration » Configure PHP and suEXEC
You can find the following error in the apache error log.

# tail -f /usr/local/apache/logs/error_logs

[warn] (13)Permission denied: mod_fcgid: spawn process /usr/local/cpanel/cgi-sys/php5 error
[error] (13)Permission denied: mod_fcgid: couldn't bind unix domain socket /usr/local/apache/logs/fcgidsock/30113.5

The result of following command will be null in this case.
root@server [~]# netstat -plan | grep fcgi


The issue is caused by the permission of /usr/local/apache/logs/fcgidsock directory. Change permission of 'fcgidsock' directory to 777 to solve the issue.

root@server [~]# cd /usr/local/apache/logs/
root@server [~]# chmod 777 fcgidsock

Check the error logs again to verify whether the issue is fixed.

If fcgi is running fine, you will get a result like following for the 'netstat' command.

root@server [~]# netstat -plan | grep fcgi
unix  2   [ ACC ]   STREAM  LISTENING  63760566 32326/php       /usr/local/apache/logs/fcgidsock/30217.17047
unix  2   [ ACC ]   STREAM  LISTENING  63760626 32327/php       /usr/local/apache/logs/fcgidsock/30217.17048
unix  2   [ ACC ]   STREAM  LISTENING  63760689 32328/php       /usr/local/apache/logs/fcgidsock/30217.17049
unix  2   [ ACC ]   STREAM  LISTENING  63760821 32338/php       /usr/local/apache/logs/fcgidsock/30217.17050
unix  2   [ ACC ]   STREAM  LISTENING  63756908 32023/php       /usr/local/apache/logs/fcgidsock/30217.17037
unix  2   [ ACC ]   STREAM  LISTENING  63761043 32350/php       /usr/local/apache/logs/fcgidsock/30217.17051
unix  2   [ ACC ]   STREAM  LISTENING  63761798 32399/php       /usr/local/apache/logs/fcgidsock/30217.17052
unix  2   [ ACC ]   STREAM  LISTENING  63761988 32415/php       /usr/local/apache/logs/fcgidsock/30217.17053