How to: Troubleshoot broken/blank WordPress sites

Summary

1. Enable debug mode.

i. edit wp-config.php

ii. set WP_DEBUG to true

2. Fix the issue.

i. reload the site to get a dump of the error on your screen.

ii. follow the instructions below to deal with memory related problems (Fatal error: Allowed memory size of 67108864 bytes exhausted).

Introduction

So, how do you pinpoint what the problem is, when, out of the blue, your WordPress site goes entirely blank? There’s a certain degree of panic involved, especially if you, just like me, are not proficient enough with the platform.

However, for example, with an ASP.NET website, you attach your debugger to the site, you go through the steps, and you identify the problem. With SharePoint, you turn the customErrors off, and you get the error dumped on the screen.

Surely there must be something similar for WordPress right?

So, the other day, I installed a new theme to my brand new website (theme name: The7), and, as soon as I activated it, I got prompted to install a number of “required” plugins. “Sure”, I thought, “why not”?

A bunch of plugins later and I was greeted with an empty page. Entirely blank. The site seemed to have died.

Even right clicking and attempting to get the page source code resulted in nothing. There was nothing there.

I tried the installation 5 times in total. Until I thought to myself, “hang on, you’re a web developer supposedly, what if it’s not .net, there must be a way to debug this thing”!

Solution

i. First, you need to identify what the actual problem is, and, to do that, you need to enable the WordPress debug more:

1. Start your ftp client

2. Navigate to your website location (if you have more than one websites, be sure to look into the folder that serves the file for the broken website!) and locate the wp-config.php file at the root.

3. Either download the file to edit, or edit in place.

4. Locate this line: define(‘WP_DEBUG’, false);

5. Change the value ‘false’ to true. This will enable the WordPress debug mode!

6. if you can’t find a line about the WP_DEBUG, just add the following line to your file: define(‘WP_DEBUG’, true);

7. Save the file (and upload back to the server, if you were editing a local copy).

ii. Reload the website in your browser. This should now dump an error message on your screen, rather than suppressing it and displaying a blank page. Depending on what your actual error message is, the solution will be different. However, if your site went blank after installing a plugin, just like mine did, chances are that you too will get the following error:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate xxx bytes) in /xxx/xxxx/xxx/xxx/xxx.php on line xxx

Notice that the above already pinpoints where the error was encountered. But, what if you absolutely need that plugin to work? Is there a way to just pass more data to the available memory allocation?

No, not really. But, there is  a way to allocate more memory!

1. Start your ftp client

2. Navigate to the root of your hosting space. If you have more than one websites, it means that you need to exit your website’s folder (the one you were at for the previous file edit) and go up a level. When you get to the root, locate the file php.ini.

3. Either download the file to edit, or edit in place.

4. Locate this command: memory_limit =

5. Make a note of the number next to the limit. Chances are it will be 64MB. Change that to 128MB. Or, depending on the error you got earlier (remember, the error clearly says how much data the system tried to process), enter a number that will be adequate to fit the request. However, don’t go crazy with this number. It actually tells the system to get a higher chunk of memory dedicated for your part of the shared hosting the provider allows you. If you go and demand a gigabyte of RAM, chances are that your hosting provider will not be too happy about it.

6. Save the file (and upload back to the server, if you were editing a local copy).

Reload the website. If your issue was memory related, and if you selected an appropriately large memory allocation, and if the provider doesn’t block your higher memory request, your site should now be back up!

MGR: the Intelogist

About MGR: the Intelogist

SharePoint Server developer, turned Sitefinity developer, turned Angular developer, turned SharePoint Online consultant, turned Unily consultant, turned O365 consultant... Never a dull moment!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.