If you are getting a 500 Internal Server error, one ore more of the problems listed below most likely exist on your script or within your account.
- You have some file or directory permissions set so anyone can write to the file.
- You have invalid code in your .htaccess file.
- You have some file or directory with the wrong ownership.
- You are using over 25 processes.
Troubleshooting Internal Server Errors (Error 500):
Every time an internal server error occurs, it will be added to your Error Log in cPanel. (cPanel >> Error Log). This will usually give you a clue on where the error resides. (remember that all PHP values have to go to your php.ini file).
Internal Server Errors due to Permissions:
Directories that need to be written-to will no longer require 777 as permissions and our server will refuse to write or read on directories exposed with such permissions. After receiving an internal server error, login to cPanel and check the Error Log, you will see an error similar to the following:
error: file is writable by others: (/home/someuser/public_html/index.php)
Simply change this file's permissions to 755 and the page error will go away.
Internal Server Errors due to .htaccess:
If any invalid commands or non-code lines are present in the .htaccess file, then you will receive an internal server error. One common instance of this error happens when users attempt to set PHP values within the .htaccess. We have PHP installed as CGI and not as Apache; this means that all PHP values must be set through the php.ini file.
Let us pretend you have just attempted to turn off the PHP setting "register_globals." If you add the following line to your .htaccess, the "register_globals" would normally be disabled:
php_flag register_globals on
This will not work. When you attempt to load your website with a php_flag in the .htaccess, you will receive an internal server error. If you check your Error Log in cPanel, you will see an error very similar to the following:.
[alert] /home/someuser/public_html/.htaccess: Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration
Internal Server Errors due to wrong owner:
If the ownership on one of your scripts are set incorrectly, you will receive an internal server error. This has been a common issue on a few content management scripts such as Joomla, and also on popular blog software like WordPress. After getting the internal server error, the Error Log in cPanel will contain an error similar to the following:
[error] SoftException in Application.cpp:303: UID of script "/home/someuser/public_html/blog/index.php" is smaller than min_uid
Internal Server Errors due to 25 processes:
On shared servers, each cPanel account is limited to 25 simultaneous processes. When you exceed the limit of processes you will experience an internal server error until additional processes are cleared out. This type of problem can cause intermittent internal server errors for very busy websites. You can also stack up processes due to poor coding. An example of this could be that you have MySQL queries that do not return results and fail to disengage. If you are experiencing an internal server error and there is no information shown in the cPanel error log, the error could be due to your account hitting the process limit.
Once you login to JailShell, run the following command to see all processes which you are currently running:
ps aux
When you discover which process it is that you would like to kill, note the PID of the process in your list and run the following command:
kill -9 PID ( In this example, replace PID with the process ID you wish to kill. )
If you wish to terminate all of your processes, please run the following command and please note that it will boot you our of JailShell.
ps -u USER | awk '{print $1}' | xargs kill -9 ( Please replace USER with your username. )