How to Fix 503 Service Unavailable Error in WordPress?
The easiest way to build a site is by using WordPress, the most popular framework. Individuals who started with WordPress may be familiar with common errors that occur often, while beginners usually have no idea about them. When beginners meet the 503 Service Unavailable error on their websites and do not know what causes it, they become anxious and grow frustrated. First and foremost, the 503 Service Temporarily Unavailable Error in WordPress is a significant problem that affects many users.
The main cause of this error might be an obsolete WordPress plugin or theme. However, if you are dealing with this situation in the case of the HTTP 503 Service Unavailable error, then go through these steps to diagnose and fix it. Furthermore, there are many possible sources, and determining the underlying cause is crucial to solving it.
What is the WordPress error: Service Temporarily Unavailable (503)?
When you get a 503 Service Temporarily Unavailable error in WordPress, it means that the web server is currently unavailable to serve incoming requests for one particular site. According to this error message, either the server is overloaded or under maintenance at the current moment; therefore users should try again later.
Fortunately, this is not a WordPress-specific error; it often appears in other well-known frameworks with the use of third-party modules or plugins. It is a programmatic message meaning that it cannot connect to the server when trying to reach out on a site. This means that your WordPress site has exceeded the limit of requests allowed.
Causes of 503 Service Temporarily Unavailable Error
This error happens if your web server does not receive an acceptable response from the PHP script. It can be a WordPress plugin, theme, or custom code snippet with improper functionality. A plugin is software that contains a set of functions integrated into the WordPress site to execute extra functionality.
A theme is a package of stylesheets and templates that define the look of a WordPress website. It alters the look and feel of your site, whereas templates determine how content is placed on WordPress websites.
If the glitch is heavy usage, a DDoS attack, or a server problem it may go away in a few minutes. But if the code on your site is bad, then this error will remain in force until you remove it from the code.
How to Fix Service Unavailable Error 503
You get the 503 Service Temporarily Unavailable error when your web server does not get an adequate response from a background PHP script. The function of a web server is to process your request to access the content on a website, conduct security checks on it, and redirect you to that page. To fix this, deactivate unwanted PHP scripts one at a time until the error is fixed.
Deactivating All WordPress Plugins
It is important to note that all your WordPress plugins are PHP scripts, and one of how you can fix the 503 Service Unavailable errors is by disabling them. As entering your WordPress Dashboard is impossible because of the error, you will need to connect directly to your website using an FTP client or CPanel’s file manager.
FTP, also known as File Transfer Protocol is used to transfer specific files from the local computer to a remote website including WordPress blogs. An FTP client is software that supports file transfer between your local system and the web server. However, cPanel is a web hosting control panel that runs on Linux and is furnished by various hosting providers. It provides tools for automation of website hosting procedures and a graphical user interface.
After the connection, go to /wp-content and rename the plugins folder as plugin old.
Then, make a new folder and call it plugins. See if this fixes the error on your WordPress site. If effective, this suggests that one of your WordPress plugins was behind the issue as these steps above turn off all plugin components.
To find the culprit plugin, go back to your FTP client or cPanel file manager. Remove the folder of empty plugins from /wp-content/.
Now, rename the folder plugins-old back to plugins. This move will allow you to use all your previously installed plugins for WordPress but keep them disabled.
Enter the WordPress Admin Area and go to the plugin page. Turn on your plugins one after another, checking various pages of your website before each activation. Repeat this procedure until you determine the plugin that leads to a 503 Service error.
If this step solves your issue, there is no necessity to go on with the following instructions provided further on this page. Else move on to the subsequent step.
Changing Your Theme via phpMyAdmin
If the deactivating plugins have not resolved the problem, then the next step is to switch to the default WordPress theme. This will deactivate your current WordPress theme.
Review all the required steps for changing your WordPress theme using phpMyAdmin.
Step 1: Select Your WordPress Database
In phpMyAdmin, look for your WordPress database on the left sidebar and click on it. You can find your database name in the wp-config file.
Step 2: Locate the wp_options Table
Inside your WordPress database, find a table called “wp_options” (the table prefix ‘wp_’ may vary based on your WordPress installation).
Step 3: Edit the Theme Name
Within the “wp_options” table, search for rows named “template” and “stylesheet.”
Click on the “Edit” button (it usually looks like a pencil) next to these rows.
Step 4: Change the Theme Name
In the “option_value” field of both rows, replace the current theme’s name with the name of the new theme you want to activate. This name should match the folder name of the new theme in your “wp-content/themes” directory.
Step 5: Save Your Changes
After making the changes, click the “Go” or “Save” button to save the new theme name.
Identifying Custom PHP Code Issues
The 503 Service error leads to the addition of third-party code through external services or snippets into your WordPress website. The difficulty is in understanding whether the problem has something to do with custom code. When the site is up and running, debugging plugins such as Query Monitor and Debug Bar come in handy.
Enable WP_DEBUG
Yet, as this mistake may prevent you from gaining access to the WordPress admin area, one can utilize WP_DEBUG, WP_DEBUG LOG, WP DEBUG DISPLAY, and @ini set constants that are enabled in WordPress.
The WordPress admin area is also known as the administration panel which authenticates users to change, manage content, and configure website settings.
Follow these steps to enable debug mode in WordPress and log errors:
Access your WordPress directory via FTP or File Manager.
Open the wp-config.php file.
Go down to where WP_DEBUG is defined, looking like define(‘WP_DEBUG’, false);. If missing, put it just above the line “That’s all! Stop editing!” Happy blogging./.
Insert the DEBUG magic codes, changing the existing code to:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);
Save changes.
For your WordPress site, the 503 Service error is triggered by reloading.
Look for the error.log file in wp-content in your WordPress install directory.
This file includes all errors on your site. If the error is brought on by a custom code snippet, it will show detailed information.
To replace the code and reload the site. If the error continues, then your web server may have some other issues to take care of.
Conclusion
If all the above methods fail to resolve the 503 Service Temporarily Unavailable error, consider the following steps:
Contact your WordPress hosting company or reach out to the WordPress Help team, as they can promptly identify and address the issue.
As a last option, you may opt to reinstall WordPress with a fresh copy to fix any persistent problems.