There are two different ways to host websites on the web. One is to go for free hosting companies like Weebly, Wix, etc. This is a good and easy option for a small site owner. However, if you are planning to run a blog or ecommerce site as your career then you should be careful in choosing the platform. Here comes the second option like WordPress, Drupal, Joomla and other PHP forums platforms. WordPress is the favorite for many bloggers and shop owners due to the vast available options.
But as an individual owner, you really need to work hard for establishing your site’s online presence. So any downtime of your site will affect the reputation and sales. The first task for you is to troubleshoot and bring the site online. In this article, let us discuss the fixes you can try when a WordPress site goes down.
How to Confirm Site Down or Not?
It is impossible task to manually open and check the site is accessible for life long. Therefore, you should arrange a way to monitor the uptime of your site and get notified whenever it goes down.
a. Using Plugin
Use plugins like Jetpack to monitor the downtime. This plugin will instantly sent an email to the administrator if it detects the site is down. Below is an example email from Jetpack indicating the downtime.
The plugin will also send an email, the moment your site is up again. This will help you to understand the duration of downtime and take further action.
b. Using Other Sites
If you do not want to install an additional plugin then try using third party monitoring solutions. There are plenty of services available out there both for free and premium.
c. Check Instant Availability
Sometimes, the site may be only down for you. Use the site up or down monitoring services to check the real situation.
Also ensure to clear all levels of caching including your browser’s cache to check the site.
Reasons for WordPress Site Down
There could be many reasons for the site downtime. One of the prominent reasons is your own activities. Below is the checklist you can try for brining your site up again.
1. Revert Back Your Previous Action
Maintaining a WordPress site needs many routine activities. You need to update the theme, plugins and WordPress core regularly to keep your site safe and secure. Problem could arise when something is not compatible or you modified PHP files wrongly. Now that your site is down, what can you do next?
- Did you modify functions.php or wp-config.php file?
- Login to your FTP and revert the changes to restore your site to previous state.
- Updated plugin or theme? For plugins, you can revert the plugin to previous version using another plugin. However, this will work only if you have access to admin panel. Otherwise you need to login to FTP and change he folder name of the plugin or theme under ‘/wp-content/’ directory.
- Did you play around with database queries? That is the worst thing you can do on the live site. If you have modified something then try to enable is again. In case, if you have deleted some table entries then the only way is to restore the database from your backup.
- Did you update WordPress? Remember major versions of WordPress will have many important changes. This may result in compatible issues with plugin or theme. If your site is down after you upgraded the WordPress then deactivate plugin or theme folder to understand the root of the issue. At worst case, you may need to go for a fresh installation with older version.
So there are so many things that you can screw up. To avoid mistakes, it is important to follow some principles instead of playing around:
- Never install or update WordPress, plugins or themes on the live WordPress site. You can always try out on localhost or staging site before deploying on production site.
- Keep proper schedule for updating and backing up your content. For example, you can have a scheduled weekly update and backup. Remember your backup is the only thing that helps to restore the site. Otherwise, you may lose the content permanently.
Do not worry about the pending updates. Fix the schedule and test thoroughly before updating on the live site.
2. Exceeding Hosting Account Limit
Well, if you did not do any action then the next probable cause could be the hosting. Most of you will start the site on shared hosting platforms without understanding the limitations. There are limitations even on cloud or VPS hosting. For example, continuously using 20% of CPU for 10 seconds will result in blocking of entire account in SiteGround.
If you have multiple sites, check whether other site is up or down. Generally hosting problem will affect at account level and take all the sites down. Login to you hosting account and check the server usage statistics or discuss with the support representative to resolve the problem.
Probably you might have installed caching plugins like W3TC with all types of caching turned on. This will create hundreds of thousands of directories and result in exceeding the file count limit set by your host. Unfortunately, you cannot identify these kind of problems with the localhost or staging site. You need to request your host to restore account and delete the plugin.
You will learn multiple lessons when discussing with your host:
- You have chosen for long-term contract without understanding the conditions. You can upgrade to next level to keep your account open or move on to another host by losing the money. So never, go for multiyear contracts because of the low price. You will feel struck when you are not happy with the host.
- Hosting company will not help you in resolving the website related problems. For example, you may notice the RAM is peaking up once in a day taking the site down. If the spike happens occasionally then upgrading hosting plan or RAM will not help. The solution is to hire a developer and do the performance testing of your site to find the root reason for the spike.
- You never need most of the attractive features on your hosting package.
So choose your hosting plan above your requirements to cope up with unexpected situations.
3. Increase in Traffic
Your site will be simply down showing 503 – service unavailable error whenever the traffic is exceeding the capacity. Generally, you may count the page views or unique visits as a traffic. However, the real web traffic has lot of dimensions.
- Real users visiting your site
- Genuine search engine robots crawling your site like Goolgebot
- Fake bots try to scrap content or try to hack
- Files on your site
Use the tools like AWStats in your cPanel to understand how your site consumes the server’s bandwidth. You will be surprised to understand that the bots cause considerable load on the server.
3.1 Blocking Bots
At initial stage of growth, you will pray Google god to crawl your site. However, later things will change that you need to control the crawl rate of search engine bots. Yes, we are talking about real search engine bots like Google, Bing, Baidu and Yandex. Learn more on how to set crawl rate for Google and Bing.
Yandex and Baidu are aggressive bots that you should straightaway block if you do not have much traffic from Russia and China. Use Search Console or Webmaster Tools account to set the crawl rate for Google and Bing. Probably you do not need them crawling your site frequently.
You also need to block the fake bots to save the bandwidth and make that available for real user on your site. Use htaccess directives to block unnecessary bots that crawl your site.
3.2. Reduce Files on Your Site
Your site contains different types of files – images, videos, advertisements, text, CSS, scripts, HTML markup, fonts, etc. WordPress will assemble all the items when someone opens a page on the browser. If you have limited server resources then ensure to understand the limitations and serve the content appropriately. For example, you can use CDN or host media files on different host or minimize the font usage.
If you clearly see the traffic is due to real users then the only option is to check with your host and upgrade the current hosting plan.
4. CPU / RAM Utilization
When the site goes down, login to your hosting account and check the PHP error log. This will help to understand which script is causing the problem. Most of the time you will see the ‘index.php’ file on your server root. This indicates that there are real users trying to visit your site. You can check the CPU and RAM utilization to understand the usage.
If your Google Analytics also shows that the traffic is genuine and increasing suddenly then the only way is to increase the capacity of your server. The traffic increase can be sudden due to the fact the Google do algorithm update regularly. Your site may pick up the traffic due to algorithm update, which you might have never predicted.
5. PHP Issues
WordPress runs on PHP and the scripts need sufficient memory and time to trigger the action. Most of the hosting companies restrict the script running time to protect the servers. If you see the real need of scripts to run long time then ask your host to increase the memory limit and PHP execution time. If you are allowed to modify the limits then follow the instructions here to increase the PHP memory limit.
If you identity the script that cause sudden RAM/CPU hike, we recommend to look for replacement instead of increasing the PHP limits. Since WordPress is an open source and commonly used, the developers should always create optimized scripts that runs on shared level environment. If that is not the case then you should try to change the script. In addition, some popular plugins that work nicely for others may create nightmare for you. Without hesitation, remove the plugin that causes downtime.
Most importantly, update to the recommend PHP version to avoid the plugins and theme causing incompatibility with your outdated PHP version.
6. Hacked by Someone
Bad people can inject unnecessary scripts on your server and take your site down. If you have not done any changes and the hosting account is good then it is a good chance that your site is hacked.
Discuss with your host and scan request them to scan your site thoroughly. You can also use plugins like Sucuri to scan your site. However, that may not be much effective after the infection. Unfortunately, your host will not help in identifying the problematic scripts. You need to troubleshoot yourself or hire an expert to check your site thoroughly.
You can also use malware scanners to scan your site and confirm the infection. The recommended way here is to change all the passwords and cleanup the entire site. Again, restore or do a fresh WordPress installation to ensure that no infected files are copied from the old content.
7. Use Debug to Find the Problems
Whenever there are problems in the PHP scripts, WordPress will show the details on the browser for troubleshooting. Since this can contain the backend information, by default WordPress hides the debugging details in frontend. If you want to see the error message in detail then follow this process to enable debugging.
- Login to your FTP account
- Open wp-config.php file on the root of your WordPress installation
- Locate the line ‘DEBUG = FALSE’ and change to TRUE.
- Save and upload the file back to your server.
- Open your site on the browser and you will see the PHP error message showing which plugin / theme causing the issue.
- Either deactivate the plugin / theme or fix the PHP error to restore your site.
- After fixing, remember to reset the debug to false in wp-config.php file.
8. Restoring from Backup
If your previous activity cannot be reverted then you need to go for restoring your site to bring it up.
- Some hosts offer regular backups, you can request them to restore the content for you. Generally, host will charge for restoring though backup is free.
- You can manually reinstall WordPress especially if the site is small and you have the backup content.
- You can get the previous version of theme and plugin from WordPress repository. For commercial theme and plugins, get in touch with theme or plugin developer to restore it back to previous version.
9. DNS Changes
Your changes in the DNS zone file may cause the site downtime. DNS changes need up to 72 hours to propagate throughout the world. If you have done DNS changes then wait for the next day for your site to work properly. Check the DNS propagation to understand the current server address accessed from different locations.
Following are some of the reasons you need to change DNS and the downtime is unavoidable is most of the cases and out of your hands.
- Changed domain name servers for enabling or disabling CDN like Cloudflare or Slackpath.
- Migrated site to another hosting company and changed the server’s IP address.
In all such cases, try to keep your previous DNS records without deleting. For example, if you want to disable CDN then keep the active connection and change the DNS to new servers at your domain registrar. At least this will help to serve the CDN files till the propagation is completed to the new server and avoid some downtime.
Do not get panic when your site is down. If you can’t troubleshoot and bring the site up, immediately discuss with your host to understand the problem better. For all site specific problems like malware attack you may need to hire specialists depending on the issue.