Articles on: ​Web Hosting

I'm getting a 500 Internal Server Error

If you see an Internal Server Error (http status code 500), it means something has likely gone wrong on the website server, however, there is usually no specific error message shown to determine the exact problem. This could be anything from your processes exhausting memory, incorrect PHP syntax or a server outage.

Before debugging and checking, it’s always worth force refreshing/reloading the web page. This can be done on Windows with CTRL + F5 or on AppleOS with Apple + R.

If you’re the Developer/WebMaster



More often than not, an Internal Server Error is due to your website sending an error message to the server, the most common causes for this are:

You have a bug in your code



If PHP comes across a FATAL error that cannot be handled, then you will get a 500 error. If you are developing a website then this is probably your first stop on the bug-fix highway. Check your error_log files for clues.

If you are running a Content Management System (CMS) like WordPress then this could indicate an issue with your theme or a plug-in - try disabling all plug-ins, see if the issue goes away - if it does, re-enable one at a time until the issue returns to identify the likely culprit. You could also enable wp-debug mode which may show an error that'll give you a clue as to what's not working correctly.

Site Timeouts



These can be internal or external resources that your site code pulls from which cannot finalise the executed code. The best way to resolve these is to add a raw debugging method to your site code to allow you to find out which process in your script is causing the site to ‘hang’.

Syntax error or disallowed directive in .htaccess files



A syntax error in your .htaccess file will almost always cause a 500 Internal Server Error. The easiest way to confirm if this is due to the .htaccess is to simply rename the file to something else and refresh your site page.

Common directives that Krystal do not allow in .htaccess files are:

FollowSymLinks - if you need to use this, please replace it with SymLinksIfOwnerMatch - it does the same thing but more securely.

php_flag php_value php_admin_flag php_admin_value - do not use these in .htaccess, as they will give an error.

Wrong permissions have been set on a PHP script



If you’re unfamiliar with site permissions this is likely something you won’t want to change as it can cause a lot of issues. A general rule of thumb is that having your permissions end in a 7, 6, 3 or 2 your site is likely to show a 500 error due to our security measures which stop users from writing to files.

We have a separate guide on setting the correct file permissions for your web files.

Your account has exceeded its allowed share of server resources



PHP Scripts often need optimising to stop them from exceeding resources assigned to your cPanel account. If you’re seeing the resources in cPanel peaking or hitting max capacity, there are a few changes you can make such as staggering your cron jobs. Please read our article on how to check your account's resource usage.

If you’re on WordPress you may need to disable your WordPress CRON and setup configurable cPanel CRON tasks.

If you’re not a Developer/Webmaster or are having issues



Try working through the steps above using our various guides which should help you gather more of an understanding of the error and if this is something you can fix, if you’re still having issues get in contact with us, we can check to see if there’s anything glaringly obvious or if it is server-side, in the event that it isn’t It may be worth restoring from a backup.

If this doesn’t work, you would need to have a developer look over your site code. We will do our best to provide you with any error codes and sign-post you in the right direction.

*

*

Updated on: 24/01/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!