How to fix PHP 500 Internal Server Errors on cPanel Server

500 Intrinsic Server Errors are one of the most demotic PHP issues that I see consumer have, and it faculty become mostly on servers with suPHP or PHP lengthways as CGI.  These errors can be caused by something on the server, or an supply on the user’s position. Here ‘s what you should do if you see errors:

Verify the logs
You can cypher most problems quick righteous by perception at the logs:

/usr/local/apache/logs/error_log

/usr/local/apache/logs/suphp.log

Here are some common errors:

SoftException in Application.cpp:357: UID of script “/home/exuser/public_html/test.php” is smaller than min_uid
SoftException in Application.cpp:ᑦ: Mismatch between target UID (511) and UID (510) of file “/home/exuser/public_html/test.php”
SoftException in Application.cpp:264: File “/home/exuser/public_html/test.php” is writeable by others

These are all permission/ownership issues, indicating that the core of the PHP enter being called in erroneous, or the permissions are higher than what is allowed in suphp.conf.

Wound directions in .htaccess

If you’re working PHP in CGI or suPHP style, you can’t use php_flag or php_value directives in .htaccess – you either condition to use htscanner to figure Athabascan to parse those commands, or pass php-related changes in php.ini within the user’s informing. You can checkout the Athabascan nonachievement log in /usr/local/apache/logs/error_log to see if you get something like this:

/home/exuser/public_html/.htaccess: Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration

If the failure log indicates a difficulty with .htaccess, you poverty to vanish the directives indicated and play reliable your ssyntax is rectify, and that they are in the correct places.

Mistaken ownership or permissions

PHP scripts and their close parent folder leave ordinarily tally permissions limits when PHP runs in CGI/suPHP mode. By option, PHP files and their parent folders can not acquire set or ‘other’ writable permissions, and cannot be owned by a human on the group new than than the somebody that owns the interior folder it is placed in. Additionally, cPanel’s implementation of suPHP does not reserve PHP to action via browser from locations that are not surface a user’s internal folder. The rank entity you should checkout is that the PHP book and its parent folder(s) are not writable by ‘group’ or ‘other’, or owned by a contrasting system soul. You can ordinarily see if this is an take by chase the suphp log in /usr/local/apache/logs/suphp.log, or whatsoever the suphp.conf has set as the log emplacement.

You can change suPHP’s permissions allowances in /opt/suphp/etc/suphp.conf to afford ‘group’ and ‘other’ writable permissions if it’s obligatory by modifying these values:

allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false

If the problem is with the min_uid value existence too low (specified as if you’re lengthwise a PHP playscript as descriptor), you can also add the “min_uid” and “min_gid” values to be much lax. Dynamical anything in the suphp.conf requires a restart of Athabaskan.

SuPHP star absent its “sticky” permissions

Swear a await at the suphp binary. It should lie a bit similar this, and in most shells, present be highlighted in red:

-rwsr-xr-x 1 root root 341K Mar 30 12:25 /opt/suphp/sbin/suphp*

If it€™s missing the ‘s’ in the permissions column, you need to re-add the sticky bit to allow users on the system to execute it properly:

chmod +s /opt/suphp/sbin/suphp

Last resort

If all else fails, you could be running a bum Apache build.  Try running EasyApache to reinstall to see if that fixes the problem.

may be useful 🙂

Incoming search terms:

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *