How to Fix WordPress Error 500 (Complete Tutorial)

The WordPress Error 500 is also known as the internal server error. It could be caused by many reasons. In this article we’ll discuss its causes and work on solving it.

WordPress is the most widely used Content Management System (CMS) in the world. It is popular thanks to being easy to use, stable, and most importantly open-source. But being the most popular CMS, it is not error proof. You might encounter a number of errors while using WordPress. The HTTP error 500 is one such error.

The good news about errors like these is, the causes are known and these can be fixed. WordPress has a big community. Development and debugging is done regularly to make this platform more stable and easy to use. Error 500 is a familiar issue and if you have the right diagnosis, it won’t take you long to solve it.

What is HTTP Error 500?

The HTTP error 500 can have many different names. For example, it is also called the “WordPress Internal Server error” sometimes. Whatever it may be called, the error itself is very problematic for your website. 

The HTTP status 500 is not specific to WordPress. What the message really means is that the server is trying to tell you that something has gone wrong, but the exact cause is unknown. When you encounter this error, you will have trouble visiting your website. Your visitors will see an error message when they visit your website. Depending on what browser your visitor is using the error message will vary.

For example, you might see a message that says “The page cannot be displayed because of an internal server error” or you may see a message like the one shown above “The server encountered an error and could not complete your request”. In any case, if the error is present, you will not be able to visit the website or display the contents of the website.

If you’ve been using WordPress for some time, you might’ve encountered this error in another scenario. This error might also occur in the middle of uploading files though your media library.

Get Latest Post Notifications!

Subscribe to our newsletter

Though the circumstances are different, the case is the same. For this reason, if we are able to debug the 500 internal server error or error 500, we will be able to fix the HTTP error 500 issue on WordPress.

What causes the HTTP error 500 error?

There are various status code errors out there. But the error code that starts with 5 and looks something like 5xx means that there is no issue with the user agent. But because of some other issues the server was unable to process the request. This could happen due to the incorrect configuration of the website or due to some other issues.

Usually the HTTP errors give you an idea about what’s causing those. The 404 is a good example. It means that the page you are trying to access doesn’t exist. Other errors like the well-known “Error establishing Database connection” directly tells you what the issue is. But the error 500 in WordPress isn’t very informative as it doesn’t tell you the exact cause.

Now that raises the big question, what causes the WordPress error 500? What we could tell, there are four main reasons why this error occurs:

  • Maximum PHP memory reached: If this is what’s causing the error then you will see it when trying to log into your WordPress admin dashboard. You might also see this when uploading media files.
  • Issue with a plugin: A plugin error occurs when codes of two or more plugins work against each other, themes, or your core WordPress files. You might have encountered this error after updating plugins.
  • Corrupted .htaccess file: The .htaccess file contains vital configuration for your WordPress website. If it becomes corrupt your WordPress site might malfunction.
  • Server error: As it is called “Internal server error”, this indicates that your issue is at the server level and not the website. 

The error 500 specifically means that there is an internal error within the web server due to which it cannot process the request from the user agent at that particular moment. This error could sometimes last for a few seconds or a few minutes. But if this error persists, this means there is a problem with the website itself. The issue could also happen due to incorrect configuration of the website, which is fixable from your end.

If you encounter this issue frequently, you should inform your web hosting provider or tech support. 

List of 500 internal server error

As we’ve mentioned above, there are several status 500 errors. For example, you might have faced a 502 bad Gateway error or the 504 Gateway timeout error. Some of the more common 500 internal server errors are listed below:

  • 500.11: The application is crashing down on the webserver when a request is being made by the user
  • 500.12: The application is being restarted on the webserver.
  • 500.13: The web server is overloaded with requests beyond its capacity.
  • 500.14: Invalid application configuration on the webserver due to corrupt or incorrect WordPress installation
  • 500.15: Direct requests for GLOBAL.ASA unallowed
  • 500.16: UNC authorization credentials are not correct
  • 500.17: URL authorization store can’t be found
  • 500.18: URL authorization store cant be opened
  • 500.19: Data for this file isn’t configured properly in the Metabase
  • 500.2: Can’t find URL authorization scope
  • 500.21: Module not recognized
  • 500.5 A rewrite error occurred during RQ_BEGIN_REQUEST notification handling. A configuration or inbound rule execution error.

There are a number of different error codes out there. You just have to troubleshoot your error code and find a fix for that.

How to fix HTTP error 500 in WordPress

In order to fix the HTTP error 500, you need to make sure that you have the following (all or at least some of the required ones):

  • Root access to your server: You need to have access to your server whether you are using a VPS (Virtual Private Server) or dedicated hosting.
  • Access to your core WordPress files: You need to have access to your WordPress core files.
  • Text editor (optional): You can use text editors like VS Code, Atom, Sublime Text, etc. to edit your code. This is optional however, as you can use a normal notepad as well.

Before continuing with the more complex troubleshooting, make sure that you’ve tried the following:

  • Wait a few minutes and then try to access your site
  • Clean your browser cache
  • Switch browser and try to access your site
  • Change file permissions and try to access your site

If none of the steps stated above works, then move on to the next steps.

1. Increase the maximum memory limit of your WordPress site

As we’ve said before, the error 500 might occur when your site reaches the maximum PHP memory limit. When you’re maintaining a website, you have to transfer files or data from your computer to the server. Some memory is required to execute scripts and if there isn’t sufficient PHP memory, you may see the HTTP 500 internal server error.

In many cases, your web hosting provider limits your memory to a certain level. But there are ways to increase the memory limit manually. To do that, you need to access your core WordPress site files.

The file that you need to edit is wp-config.php. Click on the file to open it. Once it opens, search for the line “wp_memory_limit”. If you can’t find the line of code, look for the opening php tag ( <?php ) and place the following code manually:

define(‘WP_MEMORY_LIMIT’, ‘64M’)

Once you’ve entered the code, notice the number defined right beside it.

The number beside the code indicates the maximum memory limit of your WordPress website. Typically it is recommended to have at least 64MB but you can increase the limit up to 128 MB or 256 MB according to your requirements and server resources.

You can also alternatively increase the PHP memory limit through the php.ini file. Open the file and then look for the line that defines the memory limit. It should look something like this:

memory_limit = 32M;

You can increase the number upto 64M, 128M, 256M and so on.

Once you’ve increased the memory limit, save your file and then close it. Note that: In some cases, your hosting provider might not allow you to increase your PHP memory limit manually. If that’s the case, then contact your hosting provider about increasing your PHP memory limit.
Learn More: How to Increase WordPress Memory Limit

2. Check the .htaccess file for errors

Earlier in this article we’ve mentioned the .htaccess file. This is a configuration file for your WordPress website and it consists of vital information for your website. If this file gets corrupted somehow, your WordPress website might malfunction.

Access your WordPress core files either by using FTP, SFTP, through the cPanel File Manager, etc. whatever method you prefer. Locate your .htaccess file and rename it to something like .htaccess_backup.

Once you’ve renamed the file, try to access your WordPress website again. If you don’t see the error anymore, then you’ve found the cause of your HTTP error 500. At this point, there’re a few things that you can do:

  • Check your .htaccess file thoroughly: For this process, you need to open your .htaccess file and then check the code line by line for errors. Although the file is relatively small, it’s still a time-consuming task. Besides, if you are not familiar with the code, then there’s the chance of introducing more errors.
  • Reset your .htaccess file: This is a much easier path. You simply need to replace the contents of your .htaccess file with the default code found in WordPress Codex.

The problem with the resting .htaccess file is that you’ll be removing any custom code. It would be better if you had any backup of your WordPress website. If you have any backups, you can use that to restore your .htaccess file also.

3. Check for plugin or theme file issue

If you’ve recently updated your plugins or theme, there’s a good chance that the codes of the updated files are conflicting with some other files. If you can at least access your WordPress dashboard, then you might be able to disable all your plugins and then refresh your website and check if the error still exists. If the error doesn’t show anymore, then start activating each of your plugins and reload the site after each activation.

This will eventually lead you to activate that particular plugin whose code is causing the error.

If you cannot access your WordPress admin dashboard, there’s another way you can disable your plugins. Access your WordPress core files and locate the wp-contents > plugins folder. Then simply rename the plugins folder to something else such as plugins_deactivated.

After that, try to access your website. Your WordPress website won’t be able to find the plugins directory, so it will create a new empty folder instead. If this solves your error 500 issue then one of these plugins is the likely culprit.

4. Switch your default WordPress Image Editor

This method isn’t that popular, but it can solve the error 500 issue with your website. WordPress uses 2 supports for image optimization libraries: Imagick and GD library. By default, WordPress uses Imagick, and sometimes this library can cause the 500 internal server error in the WordPress dashboard.

Switching the Imagick library to the GD library might solve the error. Generally, both of these libraries are great at optimizing any image, so switching from Imagick to GD Library won’t affect your site that much.

To make the switch, you again need to access your WordPress core files. Just access your WP files any way you prefer (FTP, SFTP, File Manager, etc.) and find the functions.php file. To find the functions.php file navigate to wp-content/themes and find the theme you are currently using. 

NOTE: It goes without saying that we don’t recommend making any changes to a template without using a child theme. If you do make any changes, it will disappear when you update the theme.

Once you find the functions.php file, open it and add the following code:

function wpb_image_editor_default_to_gd( $editors ) {
$gd_editor = 'WP_Image_Editor_GD';
$editors = array_diff( $editors, array( $gd_editor ) );
array_unshift( $editors, $gd_editor );
return $editors;
}
add_filter( 'wp_image_editors', 'wpb_image_editor_default_to_gd' );

Save your file and close it. Now check again and see if the error still exists. If not then your internal server error 500 is now gone and with the new library, you should be good to go.

Sometimes incorrect directories and file permission configuration might lead to various errors. It is essential to have the proper file permission. Permission might be different from host to host. But the file and folder permissions of WordPress should be the same for most users (depending on the type of installation you performed).

You should check if your file permissions are ok. By default, the recommended settings are:

  • 755 for all folders and sub-folders.
  • 644 for all files.

If you have incorrect file permission, then some plugins and themes might not work properly. To find out more about file permission check out the support article by wordpress.org.

If any of these steps mentioned above didn’t work and you still have the same error, then the issue might be more complex than we thought. To handle this, it would be better to enable WordPress debug mode.

Note: You can enable caching for your WordPress site to reduce server resource usage and speed up the site. Learn how to speed up a WordPress site with WP Rocket.

Enable WordPress debug mode for more diagnosis

If you have tried all the methods stated above and were unsuccessful at identifying the error 500, then the issue might not be on the website level. It is time to call your host provider for help and put your website under debugging mode.

The hosting providers usually put your website under debugging mode until they find and resolve the issue. You can do that yourself as long as you don’t mind reading error logs.

The WordPress debugger is a built-in tool that will analyze your website and generate error logs that you can view. By default the debugger is switched off, so you need to enable it manually. To do that, find your wp-content.php file which is located in the root directory of your WordPress website folder.

Once you find the file, open it and navigate to the following code:

define( 'WP_DEBUG', false );

Then change the ‘false’ value to ‘true’. Now you have turned on your debugging mode, but the errors will be displayed in the browser. To hide those errors type in the following code:

@ini_set( 'display_errors', 0 );

Now the two updated codes will look like this:

define( 'WP_DEBUG', true );
@ini_set( 'display_errors', 0 );

Once you’re done, save and close your file. Now if you go to your website, you will see the debugger is logging out the errors within your WordPress website.

The debug logs can be very hard to make sense as it might look gibberish if you don’t have any server management experience.

If you are not sure what the error logs mean, then definitely contact your hosting provider. Don’t get disheartened if you were unable to find the problem as you’ve already done a lot. You can tell the support team what methods you tried as this might help them a little bit.

There could be several other issues with your website like outdated PHP versions or issues with your hosting provider. A good host will be able to fix your error in no time.

Conclusion

When you are working on WordPress, there could be several errors that you might encounter. The CMS itself is a massive system and errors like these aren’t uncommon. To many people, debugging errors is fun and exciting while many of us feel like breaking our keyboards. That is why it is safe to have a backup of your website at all times. There are several backup plugins you can use to backup your WordPress website.

Whether you enjoy debugging or breaking hardware, it is safe to know that these errors are well-known and have already been solved. Being an open-source software there’s a large community that you can ask for help.

Just remember, whenever you encounter errors such as these, it is important to keep a cool head and approach the problem logically. Once you have the right tools, you can check by increasing your PHP memory limit, refreshing the .htaccess file, deactivating the plugins, etc.

If you found this article helpful, or if we’ve missed something, let us know in the comment section. Let us know which method worked for you and if you have any questions, leave those in the comment section. We’ll get back to you.


Disclaimer: This post may contain affiliate links and we may receive a small commission if you purchase something by following them. However, we recommend services/products that we believe good to serve your purpose.

Staff Author

Staff Author

A team of WordPress enthusiasts led by Arafat Bin Sultan, a seasoned professional with over a decade of experience in tech blogging, content marketing, and video creation.

Articles: 252

Leave a Reply

Your email address will not be published. Required fields are marked *

Discover more from WPGIZ

Subscribe now to keep reading and get access to the full archive.

Continue reading