Last Updated 23 Jul 2024
|

How To Fix the HTTP 500 Internal Server Error in WordPress

Quick Summary ↪ This guide helps you quickly resolve HTTP 500 Internal Server Errors: Back up your website > Deactivate plugins > Switch to a default theme > Check the .htaccess file > Increase PHP limits > Check error logs. Read on to discover proactive measures to prevent future occurrences.

500 Internal server error in WordPress

Have you encountered an HTTP 500 Internal Server Error on your website? For most webmasters, this can be a frustrating situation.

If you don’t manage to catch the problem early enough, your site’s search engine visibility might take a hit. You might also lose some customers and sustain long-lasting reputational damage.

If spotted and corrected early enough, there may be little to no harm done. The real problem with 500 Internal Server Error is that you often have no clue what the root cause is.

The good news is that It is generally not a serious problem and 500 internal server errors can be easily fixed once you uncover the root cause.

If you follow all the steps we’ll show you in this guide, you will have your website back up and running in no time!

What Does 500 Internal Server Error Mean?

500 Internal server error example

The 500 Internal Server Error means that the server has been unable to fulfill the request due to an unexpected condition.

As a result, the page will not load and you will see a browser page outlining the error.

Chances are, if it’s down for you, it could be down for your visitors too, making this a vital error to tackle!

When you navigate to a website, you are accessing web files and content that are stored on a remote server. Your browser communicates with this server, requesting the content that you need.

In response, the server sends a HTTP response status code back to your browser, informing it of the status of the request. If successful, the code returned to the browser will be a HTTP code: 200 OK.

The server will then execute the commands, providing a copy of the relevant content to your browser.

If unsuccessful, the server might return one of two classes of codes: a HTTP 400 or 500. Broadly speaking, these aren’t single types of errors, rather, they are classes of errors.

For example, the range of HTTP 500 errors includes codes such as:

Each of which indicates a different challenge to address.

How to Resolve a 500 Internal Server Error (Without Coding)

Before you get started with more technical troubleshooting, try these two basic fixes:

  1. Reload the page to resolve a 500 internal server error
  2. Clear the cache to troubleshoot a 500 server error

While a 500 Internal Server error can be annoying, it is typically easy to fix.

These errors can sometimes be caused by temporary, minor situations such as issues with your device, network, router or hosting service.

1. Reload the Page to fix HTTP Error 500

500 Internal Server errors can often be resolved with no need for complex troubleshooting.

Sometimes the problem is a temporary situation with your hosting service, ISP or local network. Simply refreshing the web page could be enough to load the site correctly.

If that doesn’t work, perhaps try a forced refresh. This ‘forces’ the browser to request a new page from the server rather than showing you its cached version. This is the best way to assess the current situation with any website.

You can use keyboard shortcuts to force-refresh your web pages. The combinations are slightly different depending on the browser and device you are working in.

Here are the combinations to try.

In Chrome, Firefox, or Edge on a Windows powered device, hold down Ctrl+F5 or Shift+F5 or Ctrl+Shift+R.

If you’re using Chrome or Firefox on a Mac device hold down Shift+Command+R.

2. Clear the Cache to Resolve an HTTP 500 Internal Server Error

Clearing the browser cache is a fundamental part of website troubleshooting. Browser caches help to speed up the browsing experience by storing bits of data from websites you have visited in the past.

Sometimes that cached data can become corrupted and communication between the browser and the website you’re looking at is interrupted. One symptom of this is the 500 error.

Clearing the cache is a straightforward procedure. The steps might differ slightly depending on the browser in use.

Here are the steps to clear your cache in Firefox, Safari, Chrome and Edge:

Firefox

clear firefox cache

Open up Firefox and click on the menu button.

Select Settings, then on the left hand side panel, select Privacy and Security > Cookies and Site Data and click clear data.

A popup will appear offering the option to check/uncheck Cookies and Site Data, and Cached Web Content.

What you’re after is cached content so tick this box and leave the Cookies and Site Data box unchecked. Click on Clear Data and the cache will be cleared automatically.

Safari

The process is even simpler in Safari.

To clear the cache in Safari click on the Safari menu > Empty Cache > Empty.

Chrome

clear chrome cache

To clear the cache in Chrome, open the browser and click on the three-dots icon in the topmost right hand corner.

On the dropdown menu, click on more Tools > Clear browsing data.

This will open up a new page where you will be presented with the options of clearing Browsing History, Cookies and Other Site Data, and Cached Images and Files.

Check the box to clear Cached images and files, click on Clear data, and that’s it.

Edge

Open the browser and click on the three-dot menu at the top right hand corner. Navigate to Settings > Privacy & Services.

You will see options for clearing different classes of browsing data. Choose Cached images and files and select Clear now.

clear edge cache

Note that the precise steps may vary based on the version of the browser you are using.

If neither of these two simple fixes work, then you’re going to have to apply some more technical troubleshooting methods. Some of these may require making changes to your website or your web server.

Now would be a good time to make a backup.

Troubleshooting can be a risky process and people have been known to completely lose their data.

To avoid this, back up your data safely before you get started. Most hosting providers will keep a backup of your files, but you may not want to rely solely on this.

Read on for a complete step by step-by-step guide on how to back up your WordPress website.

How to Backup Your Website

There are several methods to back up a website. You can do this by installing a plugin, by downloading the files through FTP, or by creating a backup in cPanel.

Each method has its pros and cons and may be more or less suitable depending on your skill level.

Using a Plugin

There are a few plugins you can use to create a backup of your WordPress website. One that we recommend is Updraft.

updraft backup plugin settings

Log in into the WordPress backend using the wp-admin path. Navigate to Plugins > Add new and search for Updraft.

Install and activate the plugin.

Once activated, a popup will appear, prompting you to ‘Press here to start’. You can also click on Settings under Updraft.

There are quite a few options under Settings which allow you to determine things like backup frequency, which files to include in a backup, how to save your backup, and so on. Set them up as you need.

Once you have made your choices, it’s time to put the plugin to work!

Still on the Updraft Settings page, click on the Backup/restore tab and then on Backup Now.

That’s it! Your website will be backed up.

For more detailed guidance, checkout our step-by-step guide on how to back up your WordPress website.

Backing Up Manually Using FTP/SFTP

File Transfer Protocol (FTP), is the traditional way of uploading and downloading data or content to or from your website. Secure File Transfer Protocol (SFTP) does the same thing but using extra layers of security.

To use this method, you will begin by connecting to your FTP server through an FTP client. The most popular one is Filezilla.

FTP allows for a transfer of files between two computers over a network. In this case, you will be uploading your data from your web server to your computer.

Begin by downloading the Filezilla Client and installing it on your desktop.

Filezilla interface

Next, you will need to have the FTP server address, along with your username and password. These details are usually provided by your hosting service.

You will then need to set the port to port 21 if you are using FTP, and port 22 if you are using SFTP.

Once your FTP client is all set up, the files and folders that make up your WordPress website will be visible for download.

All you will then have to do is drag and drop them into folders on your computer.

Use cPanel/Ask your Host

Most hosts provide default backup tools in cPanel. If you know your way around cPanel, this is a good option.

cPanel backup wizard

Login into cPanel and navigate to Files > Backup Wizard > cPanel Backup > Backup > Full Backup > Download a Full Account Backup > Generate Backup.

How to Fix the 500 Internal Server Error in WordPress Step by Step (Advanced Troubleshooting)

Once you have created a backup of your files, it will be time to turn to serious WordPress troubleshooting.

Here are the steps to follow, along with different methods for troubleshooting an internal 500 error on your WordPress website.

  1. Turn On Debugging
  2. Switch Themes
  3. Deactivate All Plugins
  4. Check the .htaccess File
  5. Increase the PHP Memory Limit
  6. Check File Permissions
  7. Ask Your Host (Report it to your hosting provider)
  8. Check the Database Connection
  9. Reinstall WordPress

Turn On Debugging

Once you’ve gotten your web files safely backed up, it’s time to get into the nitty gritty of resolving the 500 Internal Server Error.

As there could be a wide range of causes for this error message, the first step is to turn on debugging mode.

In debugging mode, WordPress will provide more specific warnings and error messages that help to clarify the cause of the 500 Internal Server Error.

Turning on debugging mode will require a tiny bit of coding. Before you begin, you’ll want to have a fail-safe if things go wrong.

When editing a WordPress core file like the wp-config file, the best practice is to create a backup version.

To do this, first create a copy of the wp-config file.

To find the file, enter cPanel and navigate to Files > File Manager > public_html > wp-config.php.

Go to cPanel file manager

Next, rename the file by changing its extension. In this case, you would be changing .php to .anything.

Most webmasters like to use .old but it doesn’t matter what you choose.

If things go wrong for any reason, all you have to do is first delete the modified file, then rename the copied file. In this case, that would mean turning your new wp-config.old file back to the default wp-config.php.

Once you have safely created a backup wp-config file, you’ll be ready to turn on debugging mode in WordPress.

Right click on the wp-config folder, to edit it within cPanel.

edit WP config file

When the file opens up, scroll to the bottom of the page, where you can add the following line of code:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', TRUE);
editing wp config file

Once done, don’t forget to save the change.

Once you’re done debugging, you will need to reverse this. No need to delete the code. Just replace true with false like so:

define('WP_DEBUG', false);

Again, remember to save the change.

Switch Themes

A lot of the time, when things go wrong with a WordPress website, it is down to plugin/theme upgrade issues or compatibility issues. The first step in troubleshooting a 500 internal server error will usually start by changing your theme to one of the default WordPress themes like Twenty Twenty-One.

To do this, navigate over to Appearance > Themes. Click on the theme you would like to install, in this case, Twenty Twenty-One, and activate it.

If the problem persists, you will progress to troubleshooting your plugins.

Deactivate All Plugins

To check if the problem is with your plugins, follow a similar process. In your WordPress backend, navigate to Plugins on the side menu.

Deactivate all plugins and reactivate them one after the other to see which one triggers the problem. Test between each activation to see which plugin causes the 500 error to reappear.

As soon as the error reappears, deactivate the plugin you just activated and test again. If the error disappears, you have found the cause of the error.

If neither changing your theme or plugin resolves the situation, the problem might lie a little deeper under the hood.

Check the .htaccess File

The .htaccess file is a file that controls much of how your users interact with your website. Web servers generally run on two types of software. These are NGINX and Apache, with Apache being the more commonly used.

If your web server runs on Apache, your website will need a .htaccess file that provides instructions to Apache on how access to your site should be granted.

Errors in .htaccess configuration are a common cause of 500 internal server errors.

To check if the error is caused by the .htaccess file, change its name from .htaccess to something else to prevent the server from recognizing and loading it. If this resolves the error message, then you should repair the file or create another.

The .htaccess file can be found in the public_html folder.

To find and edit it, you can either use cPanel or FTP. If you’re using cPanel, you will need to navigate to File Manager > public_html.

Right click on the .htaccess file and select Edit.

Below is what a .htaccess file should look like. If yours is in need of repair, simply paste in this code via FTP/SFTP or access it through the cPanel File Manager.

# 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]
</IfModule>
# END WordPress

If you cannot find a .htaccess file in your public_html folder, you may need to create a new one. This is easy to do.

create new file in cPanel file manager

At the top left-hand corner of your screen, click on + File. In the pop up that appears, enter .htaccess as the New File Name.

Once created, copy and paste in the code above and save the file as .htaccess..

Increase the PHP Memory Limit

When browsers send requests to a web server, some PHP memory is required to execute this process. Sometimes, a 500 Internal Server error occurs because of scripts that use up too much memory before they complete.

To fix this, you can increase the amount of PHP memory available for processing requests while you contact your web hosting service to help with finding and fixing the troublesome scripts.

There are a number of ways to increase PHP memory for a WordPress website as you will see below. By now, you will have learned how to work in these files. All you’ll have to do is add in little bits of code here and there.

Edit the .htaccess file

You’ve already learned how to work with .htaccess earlier. To increase the PHP memory allocation for your website, simply open the .htaccess file in a text editor, and add the following code:

php_value upload_max_filesize 64M
php_value post_max_size 64M

Then save the change.

You can also use 128M or 256M if required. There is no guarantee that this will work as some web hosts limit memory from the server side, which ignores the setting you’re changing. Not all hosts do this, which is why we suggest it here.

Edit the Wp-Config File

You can find the wp-config file for your website in cPanel or using FTP. Download the wp-config file from your root directory, open it in a text editor, and add the following code:

define(‘WP_MEMORY_LIMIT’, ’64M’);
ini_set(‘post_max_size’, ’64M’);
ini_set(‘upload_max_filesize’, ’64M’);

And save the change.

Increase Memory Allocation in PHP.ini

A final method of increasing your WordPress websites’s PHP memory allocation is by increasing the memory allocation from the PHP.ini file. The PHP.ini file is a PHP configuration file that controls things like execution time, memory and much more.

If you’re using shared hosting you won’t be able to edit your PHP.ini file. If you have dedicated hosting or a virtual hosting plan, you might be able to edit your PHP.ini file in cPanel.

Ordinarily, you will find the PHP.ini file stored in your root folder. You can also edit this file manually.

In both cases, first find the PHP.ini file in the root directory of your WordPress installation. As we advised earlier, to create a safety net in case things go wrong, copy a new version of the PHP.ini file and save the old one with a different extension such as .old.

Next, download the file and open it in a text editor. Paste in the configuration values you would like to use on your website–in this case, if you’re trying to set the memory limit at 128 megabytes, you would include a line of code like this:

memory_limit = 128M

If you’re working in cPanel, simply save this file and delete the backup. If you’re working with FTP, upload the file and that should fix the issue.

Check File Permissions

Another possible cause of an internal 500 error is a file permissions error. File permissions determine who can read, write and execute functions within your WordPress code.

Incorrect permissions are a security threat but they can also lead to 500 Internal Server error messages.

If things have gone awry on your WordPress website, check your permissions files to see if the the following WordPress recommended settings are still in place:

  • wp-admin: 755
  • wp-content: 755
    • wp-content/themes: 755
    • wp-content/plugins: 755
    • wp-content/uploads: 755
  • wp-config.php: 644
  • .htaccess: 644
  • All other files – 644

To check these, you can simply right click on each file in the public_html folder in cPanel or in your FTP client, and click on change permissions.

cPanel user permissions

If the contents of your version of this file look different, update it with these settings. As always, don’t forget to save your changes.

Ask Your Host

If you have tried all the previous steps and nothing has worked, you may need to report the error to your hosting service provider. They will usually be able to accurately troubleshoot any errors, and in many cases, will carry out fixes themselves.

Be sure to provide as many details as you can including what actions you suspect may have triggered the 500 Internal Server Error, as well as the steps you have taken to resolve it.

There are a couple more steps you may take if you would like to complete the troubleshooting process on your own.

Check the Database Connection

An error in establishing a database connection is another potential cause of an internal 500 server error. This can happen for a number of reasons. For example, incorrect database login credentials, a corruption of your WordPress database, or a problem with the server.

A broken database connection will be a little more challenging to resolve as you will not have access to either the front or back end of your WordPress installation.

To resolve this, you will need to access your WordPress files via FTP/SFTP or cPanel.

Next, check the php.ini file to confirm that your database login credentials are correct. As we mentioned earlier, you won’t be able to access this file if you’re using a shared hosting plan. If you are, you may need to ask your hosting service for some help.

If you aren’t, you can find the php.ini file in your cPanel, in the public_html folder.

These credentials include:

  • MySQL name
  • MySQL database surname
  • MySQL database password
  • My SQL hostname

You should have these credentials recorded somewhere from when you first set up WordPress.

If these are in order, the problem may lie with a corrupted database.

Fixing a corrupt database is straightforward. Be aware, though, that in rare circumstances, this process can cause you to lose data.

enable WP_ALLOW_REPAIR

You will have to enable database repair mode by adding a bit of code into the wp-config.php file:

define('WP_ALLOW_REPAIR', true);

You can do this from your cPanel or via FTP.

Navigate to the public_html folder in file manager, right click on the wp_config file and click Edit.

Scroll down to the bottom of the page–right before the line that says “That’s all, stop editing! Happy blogging.”, and paste in the code above.

Once this is done, visit the following address in your browser:

https://yourdomain.com/wp-admin/maint/repair.php

Once here, you will have the options of enabling a WordPress repair, or optimizing the database.

We recommend that you choose the repair option.

Reinstall WordPress

Reinstalling WordPress or reverting to an error-free version of your WordPress installation is a method that will help you get around the problem without really solving it.

If you have gone through all the previous methods without success, you may want to priorities getting your site back online and this method is the quickest way of doing it.

If you opt for this path, then be sure to build your website the right way from the beginning. Properly configured websites are less likely to run into 500 Internal Server errors, at least, not frequently!

How to Prevent a 500 Internal Server Error

armor stock image

There isn’t an exhaustive list of things that could cause a 500 Internal Server error but the following tips should help you avoid the majority of them

These are our top three tips:

Use a Reliable Hosting Service

As you might have realized by now, a lot of what could go wrong with a 500 Internal Server error may happen on your web server, out of your control.

Simply choosing a web hosting provider that provides faster servers and more bandwidth can help. You should also choose a web host that offers responsive and technically skilled customer support.

Use Properly Coded Themes and Plugins

Not all WordPress themes and plugins are built using high-quality code or industry best practices. Astra is, which is why it is so popular with web developers around the world. For a smooth WordPress experience, try Astra!

Use a Staging Environment

Major changes to your website should be tested in a staging environment before being implemented on your live site.

This will allow you to catch any issues with themes of plugins before they have a chance to cause a 500 Internal Server error on your live site.

Final Thoughts

The 500 Internal Server error can cause much distress but now you know what to do when it happens.

Like most technical troubleshooting, it’s largely a case of a process of elimination, trying a fix, testing it and then moving on to another. It’s slow and steady but it works!

Remember to create regular backups of your WordPress website and don’t wait for issues to crop up before you do!

With the steps we’ve shown you, you will overcome any instances of this frustrating error like a pro.

Recommended Articles:

If you have had to deal with a 500 Internal Server error in the past, let us know which of these solutions worked for you. We’d love to hear what tips you might have!

Article by
Pratik Chaskar

LinkedInTwitter

Pratik Chaskar holds the pivotal role of CTO at Brainstorm Force, serving as the backbone of the company. Renowned for his organizational skills, strategic thinking, problem-solving attitude, and expertise in leading and executing plans, Pratik plays a crucial role in the BSF’s technological landscape.

Disclosure: This blog may contain affiliate links. If you make a purchase through one of these links, we may receive a small commission. Read disclosure. Rest assured that we only recommend products that we have personally used and believe will add value to our readers. Thanks for your support!

Leave a Comment

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

Join 1,653,898+ Happy Site Owners Using Astra

Whether you are a beginner, small business owner, or professional web developer, Astra provides all the tools you need to easily build your beautiful WordPress website.

Download is Just A Click Away!

Membership Retention Checklist Download

REWIND

YEAR IN REVIEW

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form
Scroll to Top