The message 500 Internal Server Error is a popular HTTP status code that is sent by a server in response to a client’s request. If your web browser shows you a webpage containing this error, it means that the server powering the website you are visiting has experienced an unexpected error and cannot deliver the requested content.
The 500 Internal Server Error is a very general error message that does not point to one specific root cause. Instead, it is used as a catch-all error response whenever a more appropriate HTTP status code is not available.
Different websites are powered by different webservers and as such, each server application may present and word the 500 error a bit differently. Below, you will see some of the more popular representations:
500 Internal Server Error
Internal Server Error
HTTP 500 Internal Error
500 Error
HTTP Error 500
HTTP 500 - Internal Server Error
Temporary Error (500)
500. That’s an error.
It should be noted that while the error description may vary, the 500
HTTP status code will always remain the same as long as it is shown on the page. Here at AwardSpace, our free website hosting plan, premium shared hosting packages, and semi-dedicated servers all use the Apache webserver application to power your website. As such, should you experience error 500, you will see the text Internal Server Error
in your web browser as was shown in the screenshot earlier in this article. Our Virtual Private Server hosting also comes with Apache preinstalled, however, if you decide to purchase a VPS instance you will be able to install a different web server application if you want.
We should also note that an Internal Server Error needn’t necessarily take down your whole website. Oftentimes, the front-end of your website may experience the 500 error while the back-end may remain accessible. Another possibility is that a specific action or a sequence of events may trigger the error.
To learn what causes the 500 Internal Server Error or how to fix the problem, continue reading or jump to the section that interests you:
- What Causes the 500 Internal Server Error?
- How Can I Fix the 500 Internal Server Error?
- How Can I Fix the 500 Internal Server Error in WordPress?
- Conclusion
What Causes the 500 Internal Server Error?
As we have noted earlier in the article, the 500 Internal Server Error is a server-side error message. In other words, the error is almost never caused by the client that is connecting to the server. As such, the 500 error would likely persist even if you try visiting the website on a different device equipped with a different web browser and even a different operating system.
The error itself can be generated by many different issues ranging from incorrect file permissions, faulty .htaccess configurations, scripts that are not correctly programmed, faulty plugins and themes, and others. We will explore the more popular causes of HTTP error 500 below.
Permissions
Having incorrect file and directory permissions is one of the more common problems that can lead to an internal server error. When the incorrect permission is set, the website might not be able to retrieve or execute all necessary files which, in turn, can cause unexpected website behavior.
PHP Memory Limit
Error 500 is likely to occur if the website you are visiting is hosted on a low-memory hosting solution such as a shared hosting account. If the account runs out of memory for whatever reason, the hosted sites there may start showing strange errors, including the 500 Internal Server Error.
PHP Timeout
Every website has a finite amount of system resources available to it. These resources must never be exceeded, otherwise, all processes on the hosting account may experience a catastrophic failure. To guard against this possibility, PHP has a timeout function that limits the amount of time a PHP script can run. Once the time limit is reached, the script process is killed, freeing up system resources in the process.
However, this premature killing of the PHP script can have negative side effects on your site visitors like a 500 error. The good news here is that the error is generally triggered only when the visitor tries to perform a certain action or follow a specific set of steps that would necessitate the execution of the problematic PHP script. As long as the script is not triggered, the rest of the website should function as normal.
Bad Htaccess
Another very common issue that results in an Internal Server Error is a poorly created .htaccess
file. The .htaccess
file is used to give instructions to the server, so an error can occur even if only one character is misspelled or missing.
How Can I Fix the 500 Internal Server Error?
If you are just browsing the web and stumble upon a site that returns a 500 error page, there isn’t much you can do on your end to fix the issue as internal server errors are usually triggered by a problem with the server itself. That said, you can still try some basic troubleshooting steps. They do not have a high probability of fixing the issue, but they are quick and easy to try:
- If you have another device at your disposal, try opening the problematic webpage there and check if you still see the 500 Internal Server Error. And if you have an alternative way of accessing the Internet, such as a phone’s cellular connection, you should try using it for the test instead of your regular Wi-Fi connection.
- If you do not have access to a secondary device, you can try using a web proxy service. A web proxy allows you to visit a website using a remote computer in another location. If you do not have a favorite web proxy service, you can try using ProxySite as it is free and easy to use. Make sure that you do not disclose any sensitive information while using the proxy website as the proxy provider will have access to everything that you type.
- If you would rather not use a proxy service, then you can clear your browser cache and cookies and try loading the problematic page one more time. Most web browsers would allow you to clear your cache and cookies using the keyboard shortcut
Control
(Command
for Mac users) +Shift
+Delete
. Alternatively, you will find the option to clear your browsing data in the Advanced/Developer/Privacy section in your browser settings.
If the above steps do not resolve the issue, you should consider contacting the website owner on social media and making them aware of the error that you are experiencing.
But what about if your own website is suffering from a 500 Internal Server Error? In that case, you need to perform a whole different set of troubleshooting steps that are much more involved. As we noted earlier, there are many different reasons why your website might be showing an Error 500. Below, we will provide solutions to some of the more common problems that can cause an internal server error.
Permissions
One of the most common reasons why your website might show error 500 is when you have accidentally set incorrect permissions for the files and directories needed to carry out a certain task. Fortunately, this issue can easily be fixed using our File Manager or an FTP client.
Both our File Manager and an FTP/SFTP/FTPS client would allow you to change the permissions of a file or a directory by right-clicking on it. As a rule of thumb, you should set your directories with permission 755
(-rwxr-xr-x
) and your files with permission 644
(-rw-r--r--
).
PHP Memory Limit
Every type of web hosting, with the possible exception of cloud hosting, provides the hosted website with a finite amount of computing resources. As such, it should come as no surprise that most hosting-related applications allow you to set a memory limit on them. The idea here is to protect the server against running out of memory as this might cause it to freeze up.
One hosting component that is very important for websites like WordPress is PHP. PHP is a programming language that lets you run PHP scripts on the server in order to serve dynamic web pages to your visitors. Some scripts may require a considerable amount of memory and processing power, which is why PHP allows you to set a custom memory limit. If a script hits that memory limit, its process will be killed, thus preserving overall system stability. The downside to this restriction is that the website visitor who has initiated the PHP script will see an error on their end and it will likely be a 500 Internal Server Error.
Limiting the amount of memory that scripts can use is performed via a PHP directive called memory_limit
. You can find the memory_limit
directive inside of your php.ini
file. On our shared hosting platform and semi-dedicated servers, you will find the php.ini
file inside the PHP Settings section of the Control Panel:
In the example above, the memory_limit
is set to 64M
. You can try increasing the limit to something like 128M
that and then see if the 500 Internal Server Error persists.
If your site visitors still encounter a 500 error even after increasing the memory_limit
, then you will likely need to contact the developer who has created the script and ask them to optimize it.
And if further optimization is not possible, you should consider getting a hosting plan that offers more computing resources for your website. For example, if you are using our free hosting package, you can upgrade to a paid hosting plan. Conversely, if you are already using our paid hosting services, you should move to a semi-dedicated server or a Virtual Private Server.
PHP Timeout
PHP enables you to limit the amount of time it takes for a script to complete its execution in addition to allowing you to set a maximum memory limit.
At first glance, it might seem strange to limit the time a script has to complete its operation. In reality, the limit is necessary in order to kill any scripts that are caught in a loop or scripts that depend on external resources that are no longer available. If such problematic scripts are not killed by PHP, they will permanently take up a portion of the server’s computing resources, thus reducing the overall capacity to serve visitors.
When a PHP script is killed, its resources are freed up and the visitor who initiated the script will see an error that can be a 500 Internal Server Error. You can try avoiding HTTP error 500 by increasing the number of times scripts have for their execution before they are killed.
You can change the number of times scripts have to complete their execution in the php.ini
file in your hosting account. You can find the php.ini
file in the PHP Settings section of the Control Panel:
The directive that needs to be altered is called max_execution_time
. By default, its value is set to 30
seconds on our hosting platform. If you wish to increase it, simply set a higher number. For example, if you wish to give your PHP scripts five minutes to complete their execution before they are killed, you need to update the directive to be max_execution_time = 300
. If you do not see the max_execution_time
entry in the php.ini
file, you may need to add it manually on an empty line.
Generally speaking, there are very few situations in which increasing the maximum execution time for scripts is advisable. Instead of allowing your scripts to run for longer, you should consider optimizing them instead. Not only will this solve the 500 Internal Server Error, but it will also make your scripts more resource-efficient, allowing you to achieve higher performance using your existing hardware.
Another reason why your scripts might be hitting their execution time limits is if they need to communicate with external sources, such as a remote server or a database, but their connection is too slow. You can mitigate this issue by ensuring that your server has access to a high-speed Internet connection.
Lastly, we should also mention that your scripts may be unable to complete their execution because they depend on an external server that is temporarily down. In such cases, you should try contacting the owner of the remote server and making them aware of the issue.
Bad Htaccess
Along with permissions and PHP-specific restrictions, another common reason for getting a 500 Internal Server Error is an .htaccess
file that contains a syntax error or a typo. Such a mistake can lead to HTTP error 500 since the .htaccess
file is used to provide instructions to the web server application. If those instructions contain an error, the server software will not be able to follow them and will display an error message instead.
You can check whether the .htaccess
file is causing your internal server error by simply renaming the file to anything else, for example, .htaccess-disabled
. Once you have disabled your .htaccess
file by renaming it, you should try loading a few of your pages. If they manage to load, even with weird formatting or sections missing, then your .htaccess
file is indeed the cause for the 500 Internal Server Error. You should proceed to troubleshoot the file line by line or consult with the developer who created your website.
Lastly, we should note that the problematic .htaccess
file may not always be located in the root folder of your website. That’s because most webservers are designed to check for .htaccess
files at every level of your directory path. In other words, if your website is located in /websites/my-website.com/
, then, in addition to /websites/my-website.com/
, you should also check /
, and /websites/
for any .htaccess
files and disable them as part of the test.
Bad Code Changes
If you were not able to determine the root cause of the HTTP 500 error using the suggestions outlined above, you should think about when exactly this error started showing and what actions and edits you have performed around this time. Chances are that you have updated or installed a new plugin/component/theme or you have made manual edits on your website. Reversing those changes has a high probability of fixing the internal server error.
Restore From Backup
Should all else fail, you may opt to restore your website to an earlier, hopefully working, state using a backup. This is why it is important to perform regular backups of your files and any MySQL and PostgreSQL databases that your website might be using. If you are looking for an automated backup solution, then you should look no further than our weekly file, mail, and database backups that are created for all websites hosted on our premium shared hosting and semi-dedicated server plans.
How Can I Fix the 500 Internal Server Error in WordPress?
WordPress has become the most popular content management system due to its ease of use and a wide selection of plugins and themes. However, it can also suffer from a 500 Internal Server Error from time to time. The general advice on how to fix HTTP error 500 that we have provided above applies here as well and you should go through our suggestions. That said, in this section, we will provide some WordPress-specific troubleshooting steps which you might want to try.
WordPress Memory Limit
Earlier in this guide, we have shown you how to increase the memory limit of PHP. This is all well and good, however, WordPress also tends to limit itself when it comes to memory use. So, you can end up in a situation where PHP has additional memory to spare, however, WordPress might never request it. To fix this, you need to allow WordPress to use additional memory. You can do so by adding the line define( 'WP_MEMORY_LIMIT', '128M' );
to your wp-config.php
file. Make sure to replace 128M
with the amount of memory, you have allocated for PHP. Once you have added this directive, save your changes, and try loading WordPress one more time.
WordPress Htaccess
As we have noted earlier, one of the most common reasons for an internal server error is a problem with your .htaccess
file. Our standing recommendation is to try renaming to file to anything else which will effectively disable it. With WordPress, however, we are taking things a step further. In addition to renaming the original .htaccess
file to something like .htaccess-disabled
, you should also create a brand new .htaccess
file and place the following content inside:
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
The above code is the default .htaccess
for WordPress and is necessary for the proper operation of the CMS. Once you have created the .htaccess
file and paste the contents, save it and try loading your website one more time. Chances are that this will clear your 500 Internal Server Error.
As a quick aside, if your CMS has a default .htaccess
file that is created during the CMS installation, you should always try to reset the .htaccess
file to its default contents rather than disabling (renaming) it outright.
Disable Plugins
Apart from memory and .htaccess
issues, the next most probable reason for a 500 error in your WordPress site is a faulty plugin. This is especially true if the internal server errors started appearing right after you installed a new plugin or updated an existing one. To test this, you can disable all plugins by renaming the plugins
directory that is located in the wp-content
folder. So, if you run the website example.com, then the plugins
folder would be located in /example.com/wp-content/
. You can rename the plugins
directory to anything you like, in this example, we will rename it to plugins_DISABLED
:
Once all plugins are disabled, check and see if the 500 Internal Server Error persists. If the error is gone, then one of your plugins is indeed the culprit. You can rename the plugins
folder back to its default name and then start renaming the individual folders for each plugin one by one until you find the plugin that is bringing down your website.
Reset the Theme
Along with disabling all plugins, you might also want to reset your WordPress theme to the default one, especially if the 500 Internal Server Errors have begun after you have updated or tweaked it.
If you have access to the WordPress back-end, you can change the active theme by choosing the Themes option from the Appearance menu. And if you get a 500 error on your back-end as well, you should disable the current theme through the File Manager or FTP.
To disable the theme, navigate to the wp-content
directory in your WordPress installation and open the themes
folder there. In that folder, you should see all themes currently installed. To disable your current theme, simply rename the folder in some way. In our example below, we will add a disabled label to it:
Once the active theme folder has been renamed, the theme will be deactivated and your WordPress default theme will be loaded automatically. At this point, you should check if the HTTP 500 error persists.
A word of warning: make sure that your WordPress installation has its default theme installed and available, otherwise WordPress will not be able to fall back on it once you disable the current theme.
Update Your PHP Version
Our last piece of advice is to make sure your hosting account is running one of the more recent versions of PHP. Because there are bound to be issued if you run an up-to-date WordPress installation and you couple it with a PHP version that is five years old.
Here at AwardSpace, we always strive to support the latest stable releases of PHP and add them to our hosting platform as soon as they become publicly available. What is more, we believe that being able to change your PHP version is a basic hosting feature and this is why we support this functionality across all of our hosting plans – from our free web hosting package to our paid hosting plans, to all of our semi-dedicated servers, and, of course, our Virtual Private Server instances. To change your PHP version, simply navigate to the PHP Settings section of our Control Panel.
Conclusion
The 500 Internal Server Error is a server-side error that is very general in nature. It is returned by the server whenever a more specific error cannot be provided. And because of this lack of specificity, some instances of error 500 can be very hard to troubleshoot and resolve.
If you are a website owner and your website is suffering from a 500 error, our advice is to try the steps we have outlined in this article. If they do not help, it is best to contact the developer who created your website, the support team for your CMS, or your hosting company’s technical support team.