Troubleshooting 500 Internal Server Errors

Troubleshooting 500 Internal Server Errors

The dreaded “500 Internal Server” error is one of the worst errors you can encounter on a website! Not only is this troublesome error very generic in appearance, but it can require an extensive amount of digging across a plethora of logs just to find a potential cause. On the bright side, if you know where to look you can drastically cut down the time required to identify the cause. 

The first step needed to troubleshoot this is to track down the Apache, Nginx, and/or web error logs. The location of these will depend on how your webserver was compiled and if you’re using a control panel. A standard Apache server will keep these logs in /var/log/httpd, while a standard Nginx server will keep these logs in /var/log/nginx. Under the cPanel control panel, you can find these logs under /usr/local/apache/logs. 

Once you have found the log, you will be able to determine what is causing the error.  In our experience, there are two primary main reasons that could cause these kinds of errors.

1) The first reason we see most often is caused by incorrect or invalid file permissions, resulting in the PHP handler failing to execute the site files correctly. This can happen due to upload errors, but it can also happen automatically as a result of the backup system built in the Magento  admin, which sets the files in the Magento install to 666.  This can be resolved by using the following commands within the Magento install’s document root:

find ./ -type f -exec chmod 644 {} \;

find ./ -type d -exec chmod 755 {} \;

Once that has complete you need to set the var directory in the Magento install to 777, follow with this command:  

chmod 777 var/ -R  

After running the above, you should have your Magento files setup with appropriate permissions for PHP execution!  If you think there is a permissions error with your site, but do not feel confident in doing this, please open a support ticket and our tech team will be happy to assist you.

2) The second most common issue can be traced to certain .htaccess directive that is not compatible with the web-server.  The error log should tell you exactly which directive is causing the problem and the fix would require reverting the invalid directives to resolve the problem.  From there you may need to research and find the correct directive, or you can always open a ticket with our support team, they are always ready to help.

Questions? Contact our sales team for help!