How To Fix 503 Service Unavailable Error in WordPress site?

 How to Fix 503 Service Unavailable Error WordPress

HTTP 503 Error WordPress

WordPress is the most popular and used CMS in the world, has a super simple interface and also does not require much technical knowledge so we can get it going. However, there are situations in which we can find several errors that are not easy to solve, as in the case of ⚠️ 503 service unavailable WordPress error.

We are going to dedicate this article to this particular error, so that you will learn how to fix 503 service unavailable error in WordPress and you will also discover why it happens.

What Is 503 the Service is Unavailable error?

On the Internet, there are different codes to designate the different types of errors with which we can cross in certain situations. For example, a 404 error indicates that the requested content has not been found, just as a 403 error indicates that there is a File and Folder Permissions Error in WordPress site, an error 500 means internal server error.

In the world of hosting, error 503 ⚠️ means that the server has received our request but has not been able to process it.

503-service-unavailable-error-example-wordpress

When you encounter 503 error with WordPress, it means that the server in question is unavailable. Most of the time, it just shows up with a “Service temporarily unavailable” message.If you’re lucky, the 503 error code will have occurred because your WordPress website is under maintenance.

WordPress very briefly sets your site to maintenance mode when you’re updating a plugin, a theme, or the core software. ?[Fix WordPress Stuck in Maintenance Mode – Tutorial]

To understand it, we must know how a server works. To stop beating around the bush, our basic explanation is that the browser sends a request or number of requests to the server.

This responds with a code and dispatching the site, the mentioned code is usually 200 to indicate that the request was successfully dispatched. In case of any problem, the response code will change and a 503 error⚠️ indicates that there was indeed a problem.

For example, you can see these error codes instead:

  • ⚠️ 503 Service Unavailable
  • ⚠️ Http/1.1 Service Unavailable
  • ⚠️ HTTP Server Error 503
  • ⚠️ 503 Error
  • ⚠️ HTTP 503
  • ⚠️ HTTP Error 503

In this tutorial, we will show how to debug and fix http 503 service error in WordPress sites. Firstly, you need to understand what are the most common causes of Error 503 (Service Temporarily Unavailable) . After that, you’ll need to follow several steps in order to locate the root cause and fix HTTP 503 Service Unavailable Error in WordPress.

http error 503. the service is unavailable Error Causes

The 503 error is a distribution server error that occurs when your server cannot distribute a file to another server. It means there is a problem with the file or with your hosting provider. Sometimes, this error can occur if you have made changes to your website but forgot to update some plugins or themes. Or, if you were trying to access files on your website, but they were not uploaded correctly.

In most cases, this error occurs when there is a problem with your web host’s server or network connection. You may also see this message if someone else has tried to access your site at the same time as you (this happens often).

A 503 Service Unavailable on Fresh Install or on an already running site can be caused by  a number of things including (but not limited to):

  • It could also be a configuration problem. If you have manually entered rules in the .htaccess file or some code in a php file (for example, to do a redirect or to configure Google Analytics) and you have made a mistake, the file may behave incorrectly and this may lead to an error 503 (although the most normal thing is that it results in a 500 error).
  • The interactions between plugins and templates can also affect. Each WordPress component is usually programmed by a different development team, which may cause incompatibilities not known to each other. These incompatibilities will result in high consumption of resources and, as a consequence, ends up in an error 503.
  • A peak in website traffic can cause a 503 error if you have not taken the appropriate measures.
  • The most common is that your website has just grown and you need to buy bigger hosting or with better maintenance.

As you can see, there are many possible causes for a 503 error. Therefore, you have to go step by step, testing and discarding possibilities until you find the origin of your specific problem.

“Through error 503, the server is telling you: “Right now I am very busy. Please come back later.”

As we have been saying, error 503 is telling us that the web server at this time cannot send the requested resources. This can be a temporary error or it can be a fixed error, that is to say, it will not go “by itself”

There are several causes behind a 503 error, among which we can find problems at the level of the network, an error in the configuration of the DNS or the DNS zone of the domain in question, or even a problem of resources to dispatch the request (due to an overload, for example).

As we said, the causes of a 503 error can be several, and obviously, WordPress is not the only system that can present an error of this type, in fact, it can happen to virtually any kind of site.

Leaving aside already mentioned causes such as overloads, DNS problems or network failures, most of the 503 errors in WordPress have their origin in the use of their own scripts. Here, we are talking about those scripts that are not part of the default structure of WordPress, as well as it can also be given by problems generated at the level of plugins or even the side of the theme that we are using.

The causes of 503 service error in WordPress can be; problems at the server level as well as by some conflict on the site itself. This means that there is no universal solution for this error, but must be resolved according to each case.

By incorrect configuration

If modifying WordPress files you have caused a 503 service unavailable error, you have to restore the backup you have made of the files before modifying them. But what if you do not have a backup? Well, you have to do several things:

  • If it is a file of a plugin or theme, you can download it again from the official repository.
  • If this is not possible, you can see if your hosting provider has a recent copy of the file.
  • In both cases, you should go to the nearest tattoo studio to have the word ” BACKUP ” written on Comic Sans on the back of your hand. So surely for the next, you do not forget. 🙂

There will be situations in which you simply cannot know the origin of error 503. Especially, if your hosting plan is shared, you will not have access to some important logs for diagnosis; and anyway, some checks are very technical and you can escape.

That’s where the importance of the technical service of your hosting comes into play. If after following the guidelines of this article you are not clear about the problem, you should not hesitate to contact the experts of your hosting company.

Although sometimes they cannot give you a direct solution to the problem, surely they can help you to have a clearer picture of the situation and propose some solutions to the 503 error.

How to Fix the HTTP error 503 Service Unavailable in WordPress?

Fortunately, in general, this error is easy to solve, although reaching this solution may take some time depending on where the problem originates.

Based on the client-server model, several of the causes may be on the server side, in which case the one who will be responsible for resolving it will be the administrator of the server. If you have a good hosting provider, then it should not take long to solve a problem of this type that is originating at the server level.

But what happens if the error arises from our site? In that case, we must get down to work and first of all, examine the sources. We have mentioned some of the fixes you can implement in order to Fix ‘503 Service Unavailable’ WordPress Error

Disable WordPress plugins

In the case of plugins, the best thing we can do is start disabling them one by one.

This can be done directly from the WordPress administration panel, just enter there and you are deactivating the plugins one by one and testing the site, until you find the problematic one. What if you cannot access the panel because it also gives an error?

In that case, we have to put on gloves and get down to work, since we are going to deactivate the plugins from an FTP manager, although the cPanel file manager also works.

By means of an FTP manager, we will have to enter the wp-content/plugins folder of our site, and there we will see the folders of each plugin. What we will do is to remove permits (that is, assign permissions 000) one by one and testing the site.

Below are the steps in details to follow:

  • Access your server using an FTP client
  • Locate a file which is often named public_html WordPress root folder
  • Navigate to the wp-content directory from the root folder
  • Look for “plugins” folder, right-click on it, and choose the Rename option. Rename plugins folder with FileZilla

 

  • Change the name of the plugins folder to something such as plugins-deactivated or anything else you like, as long as you remember what it is.
  • Try accessing your WordPress website.

This process is similar to what we would do from the WordPress administrator, just keep in mind that you may need to reconfigure your plugins later. If you hit the problematic plugin, you can return the permissions to the previous ones, using the following setting should be enough:

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

Great, you’ve found the problematic plugin but you have to leave it disabled because it breaks your site, what to do in that case?

In that situation, the help should come from the plugin programmer, which is the team or person who developed it, so get in touch with the developer of the problematic plugin and report the situation.

Remove and deactivate WP theme

If you have performed these procedures and do not find a problematic plugin, then there is a possibility that the error is caused by the theme or template you are using.

If so, you will have to perform the same process that you did with the plugins, but this time deactivating the theme.

You can do it from the WordPress administrator or, if it is not available, through FTP or a file manager. Remember that templates in WordPress are stored within wp-content/themes. Search your active theme there and put 000 permissions on it or change its name, and then test your site.

  • Get access to your cPanel using an FTP client.
  • Locate the wp-content/themes from the root directory.
  • Navigate to a folder that shares a similar name to your active theme.
  • Right-click on the theme’s folder and choose the Rename option.
  • Change your theme name to mytheme-deactivated
  • Go to your WordPress website and review it as a visitor.

If the web starts working then the 503 error is caused by your theme. You can try to download it again, maybe only one file is missing and that causes the error, or you will have to contact its creator and present the case. If you cannot get a solution on that side, then surely you have no choice but to change the theme of your site.

Enable WP_DEBUG

Finally, the other possible cause of our nightmares maybe some script we have on the site. In that case, the best option we can take is to enable the sample of errors, otherwise, it will be very difficult to find the problem by doing a manual search between scripts.

  • Enable WordPress Debug Feature

But since the 503 error often locks you out of your WordPress admin, we shall use WP_DEBUG and WP_DEBUG_LOG, WP_DEBUG_DISPLAY and @ini_set constants available to WordPress.

To enable debug mode in WordPress and write errors to a log file,  follow these steps:

  1. Open your WordPress directory via FTP or File Manager.
  2. Open the wp-config.php file
  3. Scroll down to where WP_DEBUG is defined. It looks like this define ('WP_DEBUG', false);. If it is missing, we will add it just above the line that says /*That's all, stop editing! Happy blogging.*/
  4. Insert the DEBUG magic codes. Just change the above define ('WP_DEBUG', false); code to:
    define ('WP_DEBUG', true);
    define ('WP_DEBUG_LOG', true);
    define ('WP_DEBUG_DISPLAY', false);
    @ini_set ('display_errors', 0);
  5. Save changes

enable-debug-in-wp-config

This file contains all the errors on your website. If your 503 service unavailable error is caused by a custom code snippet, it will show up somewhere with details of the error.

Faulty PHP CODE

To enable the sample of errors in PHP there are several options, perhaps the simplest is to open our file wp-config.php (located at the root of the site) and add near the end of the following line:

  • ini_set(‘display_errors’, 0);
  • We must place it in the position indicated in the image, not in the last line of the file.
  • We save the change, we test the site and we should see where the source of the error is located.
  • If for some reason, we cannot access this method to show PHP errors, then we can choose to do it through our user’s PHP, as long as we can customize it clearly.
  • This should not be a problem if your hosting provides a modern server (such as LiteSpeed ​​or Nginx ) with customizable PHP, for example, if you have cPanel it is 99% sure that you can configure the variable display_errors at ease, ask your provider to turn in on/off.
  • In the image below, we can see where to make this change in the infrastructure servers through the PHP Selector available in cPanel.

 errors in PHP using display_errors

Another way to activate the display of errors in PHP using display_errors is directly editing the php.ini of the server, but we must bear in mind that for this it is necessary that we have root access to the server, and it is also essential that we know how to use the console.

In case you activate PHP’s display_errors, regardless of whether you did it through wp-config.php or with one of the other described methods, remember to deactivate it when you no longer need it, since having it active permanently is a serious failure to the security level.

Keep in mind that leaving the variable display_errors status “On” may cause part of your code, file and folder structure to be shown, and that can be used by third parties to hack your site, upload malicious content, etc.

RelatedWordPress HTTP Image Upload Error

Limit Google’s Crawl Rate (Server-Related)

Specifically, Google’s crawl is a software whose main mission is to explore the Web to analyze the content of documents visited and store them organized in an index.

The crawler, therefore, travels continuously, autonomously and automatically, the various sites and Internet pages in search of new content or possible updates of content already explored in the past.

Google’s maximum crawl rate can be another reason that causes 503 error in WordPress, which can be fixed by following 3 tips:

  • Increase the hosting packages so you will have more resources.
  • Slow down the work and do not update anything for awhile. Obviously, you’re going to miss visits, but sometimes it’s the only option. When the traffic normalizes you will recover the normal use of the web.
  • Optimize WordPress so that, in case of an avalanche of visits, it doesn’t consume so many resources and not cause an error 503. [Also Read – Optimize WordPress – Repair Corrupted Tables]

Login to Google Search Console and select your website.

Next, click the gear icon and select site settings as shown below:

On the next screen, adjust the Google crawl rate by dragging the slider to the left side:

fix-503-service-unavailable-error-in-wordpress-site-settings

503-service-unavailable-error-in-wordpress-crawl-rate-search-console

Limit WordPress Heartbeat

It’s responsible for features such as post autosaving and so on.

The WordPress Heartbeat API fires a file known as admin-ajax.php among other queries at regular intervals when you’re logged into your site.To determine if WordPress Heartbeat is the cause of the 503 service unavailable error on your WordPress site, add the following code into your theme’s functions.php file right after the opening <?php tag:

Save your changes and reload your site. If the 503 error is gone, take a breather. But if the 503 service unavailable error is still there, it means the WordPress Heartbeat API is the least of your troubles.

If the below code didn’t fix the 503 error, don’t forget to remove the code from your functions.php file.

add_action( ‘init’, ‘stop_heartbeat’, 1 );
function stop_heartbeat() {
wp_deregister_script(‘heartbeat’);
}

How To Prevent HTTP 503 error in WordPress

Before we start the problem-solving strategy, we talked about how spikes in traffic can cause 503 errors. If you want to avoid encountering this problem in the future, there are two things you can do to be proactive.

Upgrade to a Better Hosting Plan

The fact that WordPress is one of the most used CMS worldwide makes it the main target of hackers. When a security hole is detected in a plugin or at the core level, many malicious users take advantage of these common wordpress security vulnerabilities to take control of many websites.

With improved security in Managed WordPress Hosting plans by Host & Protect (Recommended), you can rest assured of security updates, backups and protection against WordPress brute force attack & WordPress DDoS attacks so you can sleep peacefully.

Use a Content Delivery Network (CDN)

We use the acronym CDN, but the real name is Content Delivery Network.

If we decipher the name, we quickly understand that the CDN is a network server for the distribution of content.

This network server is connected to the 4 corners of the world for two reasons:

  • Distribute content faster to the user: The closer you are to it, the faster the content will arrive. We are talking about a hundredth, a thousandth of a second, but it is HUGE when we know that a site should ideally load in 3 seconds MAXIMUM.
  • Securing the content of your website: Because your site is accessible from all over the world, it is “almost” impossible to discover, what is the real server that hosts your website and attacking it.

Some of the top WordPress CDN services are MaxCDN, Cloudflare & Rackspace.

Summary: http error 503. the service is unavailable.

As we have already seen, the 503 service unavailable error in WordPress can be quite annoying, but its solution is usually simple.

The problem can be presented by an error on the server side as well as originate from the WordPress site, in which case it is advisable to check our plugins and themes to find the cause, as well as activate the display of errors in PHP temporarily, with all this It should be more than enough to locate the origin.

Once we have found the origin of the 503 service error, we will have to evaluate how to solve it, and that depends on where the problem lies. Tracking user activity in WordPress can also help you in this case.

If it is a conflict of a plugin or a theme we should usually contact the developer of the plugin or the theme, while if it is a problem of our own script, we will have to see it on our own or with the help of our programmer or hosting provider.

Have you ever encountered the 503 service is unavailable error? How did you fix it? Please share with us in the comments below. Thanks in advance!

Scanning and Fixing Your WordPress Site for MalwareWe have created a custom search engine where you can find other WordPress errors, tips & tutorials – Visit Here

Other Popular Topics You Might Want To Read:

Check Out Our In-depth Guides

24/7 WP Security & Malware Removal
Is your site hacked or infected with malware? Let us get it fixed for you
Secure My Website(s)