Thursday, April 14, 2011

CGI files showing 500 internal server in Plesk

If you getting 500 internal server while executing the CGI files then please check the error log of that particular domain

eg: /var/www/vhosts/domain.com/statistics/logs/error_log

1) The error log may be showing issue with suexec policy violation: see suexec log for more details
>> Then please check the suexec log in /etc/httpd/logs/suexec.log their you will get error like below
target uid/gid (10078/505) mismatch with directory (10078/504) or program (10078/505)

Fix: /bin/cp /usr/sbin/psa-suexec /usr/sbin/suexec
OR
cp -arf /usr/local/psa/suexec/psa-suexec /usr/sbin/suexec

restart the Apache and try to load the cgi file.
(Reason: Plesk uses it's own suexec file and it might have been replaced by the original one that comes with standard apache package. )


2) In the error log if you getting this error : Premature end of script headers:

Fix: Make sure that the cgi-bin/ folder has the following permissions and ownership:

drwxr-x--- myuser psaserv cgi-bin

The script itself must be owned by domain FTP user but group must be 'psacln':

-rwxr-xr-x myuser psacln script.cgi

The permission should be 755 for your script.cgi file.

1 comment:

  1. Thanks you for the suggestion with suexec. I was having this problem with CentOS on a HostGator install. I have no idea how the problem occured to begin with, but copying the psa-suexec file fixed the issue for PHP at least.

    ReplyDelete