Facing a 503 error can be quite frustrating, as it signifies that the server you’re attempting to reach is currently unavailable. Unlike other error codes, a 503 error specifically suggests that your website is up and running, but inaccessible at that particular moment. This issue can arise due to various factors, with a common reason being the server being overwhelmed by high traffic or undergoing maintenance.
However, if this 503 error continues to persist, the situation becomes more serious. It not only hinders visitors from accessing your website but also denies you entry to your WordPress admin area. Consequently, making any updates or changes to your site becomes impossible. To tackle this problem, you’ll have to delve into the files within your WordPress installation to identify and troubleshoot the underlying cause of this error.
What Causes a 503 “Service Unavailable” Error?
The 503 error presents a significant challenge due to its limited information provided to users. Typically, a generic message like “Service temporarily unavailable” is displayed, offering very little insight into the specific issue.
But, there are several potential causes for a 503 error on a WordPress site. Here are some common factors that can trigger this error:
- Plugin or Theme Issues: In some cases, a poorly coded or incompatible plugin or theme can lead to conflicts or excessive resource usage, triggering a 503 error.
- Server Overload: If your server is experiencing high traffic or resource usage, it may become overwhelmed and be unable to respond to requests, resulting in a 503 error.
- Maintenance Mode: If you have activated maintenance mode on your WordPress site, it can cause a 503 error to be displayed while updates or modifications are being made.
- Server Configuration Issues: Misconfigurations in your server settings or inadequate server resources, such as memory or CPU limitations, can result in a 503 error.
- Database Connection Problems: If your WordPress site is unable to establish a connection with the database, it may lead to a 503 error.
- Distributed Denial of Service (DDoS) Attacks: A sudden surge in traffic from a DDoS attack can overwhelm your server, causing it to respond with a 503 error.
Fixing the 503 Error
To effectively troubleshoot the 503 error, it is essential to approach the issue methodically by considering the following six potential fixes, each targeted at resolving various underlying causes.
After implementing each fix, test your website to see if the 503 error persists. If the issue is resolved, you’ve successfully fixed the problem. If not, move on to the next step until the error is resolved.
1. Deactivate the Plugins Temporarily
The compatibility issue with plugins in WordPress is one of the most common causes of the 503 error. You’ll need to deactivate all of your site’s plugins to make sure that is the case. And since you can’t access the admin area because of the error, you will need to delve into the files of your WordPress installation.
You can access the WordPress files either via your hosting site’s file manager or via SFTP using an FTP client.
Once you have access to your WordPress files, double-click the root folder (usually public_html, html, www, public, or your site’s name) to open it.
Once you’re in the root folder, navigate to the wp-content directory and then the plugins folder. This folder contains all of your site’s installed plugins.
To disable the plugins temporarily, all you need to do is rename the folder by right-clicking it and selecting the Rename option. Rename it to something that is easy to recognize later such as myplugins.disable.
After disabling each plugin, make sure to access your website and check if the 503 error is resolved. This process may take some time, especially if you have many plugins, but it is essential to methodically verify each plugin individually.
If the error disappears after deactivating a specific plugin, you can conclude that it was the likely culprit. Afterward, you can rename other plugins’ folders to their original name to enable them again.
2. Deactivate the Website Active Theme
Having eliminated the possibility of issues caused by plugins, the next step is to test your active theme to determine if it is the root cause of the 503 error.
To troubleshoot the issue, you can switch the currently active theme to one of the default WordPress themes, like “twentytwentythree,” which is the default theme for the latest WordPress version as of version 6.2.
To accomplish this, you’ll need access your WordPress database by logging into phpMyAdmin on your hosting site’s dashboard.
Once you gained access to phpMyAdmin, click into the wp_options table. The “wp_” prefix could be different depending on your settings. Continue by clicking on the Search tab, then search for “template” in the option_name.
You will see the current name of your active theme under the option_value. Edit that value to one of the default WordPress themes such as “twentytwentythree”.
Now, click on the Search tab again, and this time you will search for “stylesheet” from the option_name once more.
To complete the process, modify the “stylesheet” option_value to exactly match the “template” value you previously added (“twentytwentythree” in this case). This change will set the “twentytwentythree” theme as your new active theme, potentially helping to resolve the 503 error.
3. Temporarily Deactivate Your Content Delivery Network (CDN)
At times, the 503 error might occur not due to issues with your website but rather because of your Content Delivery Network (CDN). If you have implemented a CDN, a convenient method to determine if it’s the culprit is by temporarily disabling it.
Most CDNs offer a feature that allows you to pause or deactivate their services. For instance, if you are using Cloudflare as your CDN, you can easily achieve this by clicking on the “Pause Cloudflare on this zone” link within your Cloudflare dashboard.
By deactivating the CDN temporarily, you can assess whether the 503 error persists without CDN involvement. This will help you identify if the CDN configuration or settings are contributing to the problem. Once you have pinpointed the cause, you can proceed with the necessary adjustments to ensure your website functions smoothly with or without the CDN’s assistance.
4. Check Error Log and Enable WP_DEBUG
You should take advantage of your hosting error logs. Usually, you can find it on your hosting site’s dashboard.
The Error Log serves as a system record that documents instances of failures, providing insights into issues and their potential solutions. This file often includes information about the timing and origin of errors.
You can also enable error logging manually by adding some lines in the wp-config.php file. Particularly useful if your host doesn’t have a logging tool.
To get started, connect to your WordPress file again and locate the wp-config.php file in your website root folder.
Right-click on the file and choose View/Edit option, which will open the file using your local text editor. Once opened, add the following code snippet before the /* That’s all, stop editing! Happy publishing. */ line:
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );
If your wp_config.php file has the WP_DEBUG line but the value is false
like follows:
define( 'WP_DEBUG', false );
Then you just need to change the value to true
and add the next two lines from the code snippet above so it can create a debug.log file whenever an error occurs. Typically, the log file is located in the wp-content directory.
Deciphering the debug log might seem daunting, but it’s less complex than you might anticipate. Essentially, the log records each error that occurs on your website in a chronological sequence. It pinpoints the specific file responsible for each error and even highlights the precise lines of code involved.
Regrettably, you won’t come across direct mentions of the 503 error in the log. Nonetheless, if other approaches have proven ineffective, the log can still serve as a guide by revealing which files are triggering issues. This insight can direct your focus towards the right areas for troubleshooting.
Sometimes the error might not generate a log file due to it being a critical PHP error and requires you to go deeper into the PHP settings. In such cases, reaching out to your hosting provider becomes a viable option, as they can provide further assistance in rectifying the error on your website.
5. Temporarily Deactivate WordPress ‘Heartbeat’ API
The WordPress Heartbeat API plays a crucial role in facilitating real-time interactions and updates within the platform such as auto-saving content, showing you plugins notifications, letting you know when someone else is working on a post you’re trying to access, and more.
However, its frequent background activity can sometimes consume excessive server resources, leading to potential issues like a 503 error if the server becomes overloaded. To troubleshoot and identify if the Heartbeat API is causing the problem, a quick solution is to temporarily deactivate it.
To accomplish this, access your WordPress website via SFTP, navigate to your current theme folder, and locate the functions.php file.
Right-click on the file and choose View/Edit option, which will open the file using your local text editor. Once opened, add the following code snippet at the bottom of the file:
add_action( 'init', 'stop_heartbeat', 1 ); function stop_heartbeat() { wp_deregister_script('heartbeat'); }
The above snippet will tell WordPress to disable the Heartbeat API. Once the snippet is added to the file, save the changes, upload it back to the server site, and try to access your website again.
If the 503 error disappears after deactivating the Heartbeat API, it indicates that the API’s usage might have been a significant factor in the server resource overload. At this point, you may want to consider alternative solutions or optimizations to manage server resources more efficiently while still benefiting from the features offered by the WordPress Heartbeat API.
6. Increase Your Server Resource
Some hosting plans such as dedicated hosting Virtual Private Servers (VPS) let you monitor the server resource usage so you can almost immediately know if the 503 error is due to the depleted server resource. But if you’re on a shared hosting plan or any similar plan which doesn’t have the ability to monitor the server resource, and the error still persists even after all your attempts to fix it, then there is a good chance the problem might be due to a lack of server resources.
However, upgrading your hosting plan is a crucial decision. If you are currently benefiting from a hosting service with excellent support, the initial action to take is to reach out to their support team. Engage in a discussion about the encountered 503 error and the attempt you’ve made to resolve it so far. Their knowledgeable assistance can help you diagnose the underlying cause and offer valuable advice on whether upgrading your plan is the right course of action.
Additional Step for VPS Users with Third-Party Control Panel
In the context of utilizing a Virtual Private Server (VPS) along with a third-party control panel such as cPanel and Control Web Panel (CWP), if you find yourself unable to access your WordPress site due to persistent occurrences of a 503 “Service Unavailable” error, it’s conceivable that this issue stems from an inability of the web server (such as Nginx or Apache) to effectively establish communication with the PHP-FPM (FastCGI Process Manager) backend.
This could also arise if the PHP-FPM backend becomes overwhelmed and consequently struggles to manage the incoming influx of requests. Despite attempting the previously mentioned solutions, if the problem endures, this underlying communication barrier between the web server and PHP-FPM might be a significant contributing factor to the persistent 503 error.
To resolve this issue, begin by accessing the PHP-FPM settings within your control panel. For cPanel, locate the option labeled System PHP-FPM, and for CWP, find the PHP-FPM Selector option. From there, proceed to restart the PHP-FPM service by temporarily stopping it and then initiating the service once more.
Next, proceed to address account permissions and related issues. If you are using cPanel, simply locate the Convert All Account to PHP-FPM button adjacent to the PHP-FPM activation option, which we previously used to restart the service. Clicking this button can help resolve the 503 error for your website.
For CWP, navigate to the User Accounts menu and utilize the Fix Permission settings. Choose the specific account you wish to rectify, select the checkboxes corresponding to Fix Permissions and Internal Server Error options, then finalize the process by clicking the Fix Selected Issues button. Subsequently, test your website to confirm if the 503 error has been effectively resolved.
In Conclusion
A 503 error can be frustrating and indicates that the server is temporarily unavailable, while your website is still operational but inaccessible. Commonly caused by high traffic or maintenance, this issue can escalate if not resolved, hindering user access and blocking your ability to make updates through the WordPress admin area.
By systematically troubleshooting potential causes and applying targeted fixes such as deactivating plugins, checking error logs, and adjusting server resources, you could successfully address the 503 error and restore full functionality to your website.