HTTP 500 Internal Server Error – An Intro

For every request from the client (like a browser), a response is sent back by the server which is called http response. A few commonly known http response codes are:

  • HTTP 500 – Internal Server Error
  • HTTP 501 – Not implemented
  • HTTP 502 – Bad Gateway
  • HTTP 503 – Service unavailable
  • HTTP 504 – Gateway timeout
  • 404 – Page not found error
  • 200 – The request has succeeded
  • 410 – the requested page is gone

What is 500 http internal server error and Why it occurs?

The server errors are in the form of three-digit integer (5xx). The http 500 error is one of the server response codes that occur for different reasons.

If for some unexpected condition, the server is unable to fulfill the request – the server responds with the “catch-all” response code 500 (Internal Server Error) to the client.

As such, the 500 server error is “catch-all”, there can be different reasons if that happens to your website or with the website you are trying to access.

In this tutorial, I will explain why 500 internal server error occurs and suggest the solutions for fixing this server error. You can see solutions for Apache, IIS and fixing the 500 error for WordPress based websites.

The second last section describes the IIS server solution which is relatively easier to identify. The last section suggests a solution if you are a visitor to any website and seeing 500 error in your browser. So, please jump to that section directly if you are a non-owner of that website.

What are the possible reasons of 500 (Internal Server Error)?

As such, the 500 server error occurs for a server’s unexpected condition and the error details are general, so there may be various possibilities for the error. There is almost nothing (except one thing explained below) that you can do at client side to resolve this issue.

http error 500 2 genenral

Following are the general possible reasons:

  • Your server’s .htaccess file is causing problems (for Apache server)
  • CGI/PERL syntax or coding errors
  • PHP timeout error – This can happen if your PHP script is trying to connect to an external resource e.g. MySQL database on another server and that does not respond. In that case, a 500 error can be returned in response to the browser.
  • Check the error logs. This can be gem under the circumstances. The server logs can provide information about website failure, code failure etc.
  • If you are using WordPress CMS and facing 500 code error then read its detail to fix the issue in later section of this tutorial.
  • This error can also be caused by permission to file system.
  • If you are using MS IIS server to host your website then it has more specific details (explained in its section below).

The 500 – internal server error message appears in different ways, as such this message can be customized by the website owner or a general different template is used by a theme or web host. For example, this is how http 500 message can be displayed if you experience this:

500 Error

Temporary Error (500)

500 Internal Server Error

HTTP 500 – Internal Server Error

500 Error – Sorry, we will get back soon!

Now let us go through the details of these reasons and try to fix the http 500 error. You should scroll to the section directly that relates to your scenario closely. For example, if you are on IIS then go to its section rather than reading the other details.

Fixing the 500 http error if caused by .htaccess file

If your website is hosted on Apache web server then it is using .htaccess file. If you have no idea, the .htaccess file is a configuration file used by Apache web server.

http 500 error htaccess

The Apache web server offers many features that you may enable or disable by using the .htaccess file. Each website hosted on the same server may have its own .htaccess file, thus using its own configuration settings. A few important settings that can be set by .htaccess file are:

  • Redirection – For example, if you want visitors to redirect for the unfound pages with error 404 (page not found) then you may set a target page there.
  • Allow/Disallow IPs for accessing a website
  • Disallow visitors by certain referrals
  • Disabling the directory listings
  • If you don’t want to allow access to php.ini file then it can be done there
  • And many more. As this is not the topic of this tutorial, so I will keep it limited.

Fixing the .htacess file

Chances may be that your .htaccess file is changed and there is a syntax error. If that is the case, a 500 internal server error is returned and the user’s browser will show it instead of your website.

For confirming that .htaccess file is causing the 500 error, you may do two simple things:

  • Backup the .htaccess file and remove it from your website directory. Restart the Apache server and refresh your website. The default settings should be used by Apache and if .htaccess was the reason, it should be evident now.
  • You may also rename the .htaccess file and restart the web server and check your website if it loads or not.

In both cases, if website loads properly then you should go through the .htaccess file and check for any syntax errors there.

I have WordPress CMS and experiencing 500 server error

If you are using WordPress CMS and your website was functioning properly and suddenly seeing the 500 error as accessing your website from the browser then there can be different possibilities but two are common:

  • .htaccess file got corrupted
  • PHP memory limit

Let’s look at these in detail.

.htaccess file is corrupted

As such, WordPress uses PHP/MySQL combination and generally WordPress based sites are hosted on Apache Web Server under Linux OS. In that case, this is most probably that you have .htaccess file in place.

500 wordpress htaccess

The settings of the .htaccess file depend on the hosting company and it varies from host to host. The reason of corrupted .htaccess file in case of WordPress can be an installation of a plug-in, broken installation of a theme or it is affected by a module.

As we first have to determine that .htaccess file is the cause of 500 status code; let us first confirm this.

  • Login to your WordPress website via FTP or cPanel.
  • In the root directory, you should see the .htaccess file.
  • Download this in your computer and take a backup.
  • Now, open the .htaccess file in your text editor.
  • Go to this URL on the official WordPress website:
  • There, you can see sample code for various WordPress installations. For example, a basic WordPress website .htaccess file’s code is like this (as per WordPress official website):
# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]


# END WordPress

Similarly, if you have WordPress Multisite for WordPress 3.5 or above then get the code accordingly and place in your .htaccess file.

  • Overwrite the existing .htaccess file by your FTP to this updated file.
  • Refresh the website.
  • If that works, that means .htaccess was corrupted.

Now, look back at your recent installations (plug-ins, themes etc.) and fix any issue there.

Increasing PHP memory limit

The other common reason of http 500 error in WordPress websites can be PHP memory limit.

For basic WordPress websites with just a few plug-ins, low memory in shared hosting works. However, as you start installing more plug-ins, it needs more memory. It may be taken as same as your computer RAM works. With less and light applications, less memory is required. As you install more and heavy applications that need more memory, the performance of the computer starts declining; so is the case with WordPress.

The 500 internal server error can be caused by using too many plug-ins or a plug-in taking many resources.

So, if you have no idea; the first question is how to check PHP memory size for your WordPress website?

This depends on the type of hosting and the company you are using. If you are using shared hosting then you may need to contact your hosting provider and request to increase the memory size.

Generally speaking, the memory size can be changed by using these ways:

  • ini file (PHP configuration file)
  • .htaccess file
  • Wp-config file (WordPress configuration file)

Accessing memory size in php.ini file

If you have access to php.ini file then this is how you may change/increase the memory limit.

  • Open the php.ini in your text editor or if it is available under your account’s control panel.
  • Search for this “memory_limit” in the file.

You should find lines of code like this:

memory_limit = 28M

 max_execution_time = 300

 upload_max_filesize = 20M

 post_max_size = 24

Change the memory limit value and save the file (or upload it if you have downloaded and connected via FTP).

Knowing php.ini information for non-cPanel access

If you don’t have access to php.ini file via cPanel and not sure what is memory limit size is then you may also find the PHP configuration for your website by following these steps:

  • Create a file with the name of “checkphp.php” on your computer.
  • Write this line of code after opening this file in an editor:

<?php phpinfo(); ?>

  • Save the file and upload it via your FTP software to the root directory.
  • Go to the browser’s address bar and type the URL to access this file. For example:

This should open the configuration table for PHP like this:

php ini config

Now search for “memory_limit” and you should be able to see the current setting.

Changing the memory_limit via wp-config.php file

As mentioned earlier, the wp-config.php file is used by the WordPress for WordPress configuration. You may set many things there e.g. MySQL database name, user and password. Besides, the memory size for WordPress can also be set there.

In order to change the memory limit, follow these steps:

Please take the backup of the existing wp-config.php file, so in the case of failure, you may immediately replace it by the previous file.)

  • Connect to your website via FTP or via cPanel.
  • If you are connected via FTP then go to the root of your WordPress installation. There, you should be able to find the wp-config.php file.
  • Download it your computer and open in the PHP editor.
  • Include these lines within the PHP opening tag (adjust the memory values as per availability):

define( ‘WP_MEMORY_LIMIT’, ‘100M’ );

define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ );

Save the changes and overwrite existing file.

Using .htaccess file for increasing memory limit

You already know how to access your website’s .htaccess file. Just include these lines after the opening tag of PHP:

php_value post_max_size 64M

php_value upload_max_filesize 64M

(Again, use the memory value as per availability)

If these lines are already there then you simply increase the “M” size and upload the .htaccess file.

What if I am using Microsoft IIS server?

Now let me explain fixing the 500 error if you have hosted your website in IIS (Internet Information Server).

http 500 error IIS

Fortunately, the IIS server gives more specific details if your website starts showing 5xx server error. By having the idea what these codes mean, you may perform a more specific action to fix that issue.

The details below show various http 500 codes (or sub codes) with a little description that applies to IIS:

  • 500.0: ISAPI (Internet Server Application Programming Interface) or module error occurred.
  • 500.11: That means your application is shutting down on the web server.
  • 500.12: Application is busy restarting on the web server.
  • 500.13: The IIS server is too busy.
  • 500.15: Global.asax direct access is not allowed.
  • 500.19: That means the configuration data is not valid.
  • 500.21: Module not recognized.
  • 500.22: An error related to ASP.NET.
  • 500.23: This error is also related to ASP.NET
  • 500.24: An ASP.NET impersonation configuration does not apply in Managed Pipeline mode.
  • 500.50: During RQ_BEGIN_REQUEST notification handling, a rewrite error occurred.
  • 500.51: During GL_PRE_BEGIN_REQUEST notification handling, a rewrite error occurred.
  • 500.52: This error occurs during RQ_SEND_RESPONSE notification handling (also rewrite error).
  • 500.100: Internal ASP error.

You can see, almost all errors are self-descriptive. So, if you are using IIS server for hosting your website then tackling the 500 error issue should be straight forward.

For more information on the official website regarding IIS 500 code errors, visit the website here.

How to troubleshoot 500 error from client side

As mentioned earlier, the http 500 is a server-side error, so nothing much could be done at client side to fix this. However, a few simple steps can be taken if it is occurring at your side only.

Solution 1 – Remove the cache

This is probable that the 500 error is occurring due to a cached copy of that website in your computer. So, what you can do is to clear the cache of your browser and restart it.

This is how you may clear the cache of commonly used Google Chrome browser:

  • Press short key from your keyword (Ctrl + Shift + Delete)
  • This should open the Settings page and the active tab should be “Clear browsing data” as shown in the graphic below.
  • Keep the appropriate tabs selected and the number of days and press the “Clear Data” button.

http 500 google cache

Similarly, you may remove the cached data from the Firefox browser as follows:

  • Use the short key – Ctrl + Shift + Delete
  • Select the appropriate options and press the “Clear Now” button

Note: You may also access clearing cache options by using both browser’s menu.

Solution 2 – Removing the cookies

By following the above section’s steps, you can also see selecting the cookies option to remove from the browser for the specific period of time.

Little chances are that 500 issue is caused by the cookies used by that website. After removing the cookies, restart the browser and reload the website.