503 Service Unavailable
READING TIME: MIN
The 503 (Service Unavailable) status code indicates that the server is currently unable to handle the request. This may be due to a temporary overload or scheduled maintenance. This is another one of the HTTP error codes that you might come across and as we know the codes starting with 5 are the ones that we want to happen. This one, in particular, tells you that your site is live but it just cannot be reached at this moment.
Understanding 503
In a rare moment, this error might come up while you are updating your core files or your theme or your plugins. When doing that WordPress briefly shifts your site under maintenance and it is possible if you try the site at the same time that you encounter this.
But if the issue persists then it is more likely that there is a bigger problem. There are different variations of the error and you might see some browser notices like the following:
- 503 Service Unavailable
- 503 Service Temporarily Unavailable
- HTTP Server Error 503
- HTTP Error 503
- Error 503 Service Unavailable
What you can do in a situation like this is to try some checks and fixes such as:
Fixing 503 error in WordPress
1) Deactivate your plugins
It is possible that there was some plugin incompatibility and this might have caused the dreaded error. So it is a good check to disable all plugins and then check your site if it will load. If it loads okay, then you know that it is some of the plugins. You might try to enable them one-by-one and reloading the site to that you can isolate the faulty one. One of the fastest options will be via WP-CLI if you have access to a terminal. Just perform the following command:
wp plugin deactivate --all
in the document root folder of the website.
Another popular option will be to rename the plugins folder in wp-content. You can do this via SSH, FTP and via the File Manager from the control panel.
2) Switch your theme
Themes can also be the reason for such issues. One fast and safe check that you can do is to switch from the current theme of your site to say one of the default ones. Then you can try to load the site and see the result. The fastest way to do this will be via WP-CLI. Just execute the following command via terminal and from the document root of your site:
wp theme activate twentysixteen
This will activate the twentysixteen default theme. But have in mind that the theme must be installed in order for you to activate it. If it is not installed you can then upload the theme folder into the themes folder in wp-content.
Another way to change your theme can be via the phpMyAdmin tool. You will need to navigate to the wp-options table, then search for the ‘template’ and ‘stylesheet’ fields and just replace the current name with another theme that you have installed on your site.
3) If you are using a CDN service such as Cloudflare or other CDN, you might want to deactivate it for a while, then clear your browser cache and check the site again
4) Check and increase your server resources – If you happen to see this error often and if it is for brief periods of time, then there is a high chance that the server is running out of resources. This is often happening with some cheap shared hosting plans and it is a good indicator that the server is quite packed with user accounts and many many websites. You can check this with your hosting and then consider upgrading or changing hosts.
5) Check server error logs and access logs as well as the debug log in WordPress. You can check the logs for any particular pattern when this happens. And you can also enable WP Debug Mode by adding the lines in your wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
This will log any issues in a file called debug.log in your wp-content dir but without them going on your site’s front-end.
So to summarize – 503 is not something that we want to see but it is also something that is not too rare. Testing with the above points on your own can give you at least a clue as to what was the root cause and once you narrow it down you can then proceed further to resolve the issue.