How to Fix Plesk Internal Server Error with PHP CGI/FCGI
Introduction
When using Plesk PHP 5.3.x, PHP applications may return an Internal Server Error (500) when the PHP handler is configured as CGI or FastCGI (FCGI). Changing the PHP handler alone may not resolve the issue.
A common cause is incorrect ownership of the suexec binary, which prevents Apache from executing PHP scripts.
Prerequisites
Before proceeding, ensure you have:
- A Linux server with Plesk installed
- Root or sudo access
- SSH access to the server
- PHP configured to use CGI or FastCGI
Implementation
Step 1: Verify the Error
If your websites display an Internal Server Error, check the Apache error log. You may find an error similar to:
Premature end of script headers: cgi_wrapper (13)Permission denied: exec of '/usr/sbin/suexec' failed
This indicates that Apache is unable to execute the suexec binary due to incorrect permissions or ownership.
Step 2: Check the Ownership of suexec
Run the following command:
ls -l /usr/sbin/suexec
If the ownership is:
root root
it should be changed to:
root apache
Step 3: Update the Ownership
Execute the following command:
chown root:apache /usr/sbin/suexec
Verify the changes:
ls -l /usr/sbin/suexec
The ownership should now display as:
root apache
Conclusion
If Plesk websites using the CGI or FastCGI PHP handler are returning an Internal Server Error, correcting the ownership of the suexec binary can resolve the issue. After updating the ownership to root:apache, verify that PHP pages load correctly and no further suexec permission errors appear in the Apache logs.
