Usually this happens in a suPHP environment. There could be few reasons why this could happen. We list here a few. The solution is intended for those with shell access.
chown your_username.your_username path_of_your_php_file
If that fixes only that file and not your entire php files, use the below command to change all the php files.
find . -type f -name “*.php” -exec chown username.username {} \;
find . -type d -exec chown username.username {} \;
Ignore “*.php” in the above command if it still errors out for a php file. If it still don’t fix, move on to other solutions below.
find . -name “*.php” -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
Often, you can do the above command without the -name “*.php” in the command.
cat /dev/null > /usr/local/apache/logs/error_log
If you know any other cases which require another solution for this, please comment here or edit the blog.
Not a common issue. But sometimes this happens. If you have noticed, when you are logged into cPanel or WHM using the root password, you wont be able to install Fantastico applications or access MySQL DBs using phpmyAdmin. Most of the times, the error occurs will be similar to below
Internal Server Error
Premature end of script headers: php: Please check /usr/local/cpanel/logs/error_log for the exact error.
So far, the solution of this issue didn’t get complicated and a simple recompilation of cPanel PHP used to solve the error. To recompile cPanel PHP, issue the command below
/scripts/makecpphp
This would make sure that cPanel PHP, suPHP and other permissions will get set properly. Good luck.
Continue Reading