Blank page errors can be extremely frustrating. As usual, diagnosis is most of the work in fixing a web site issue, and a blank page doesn’t do much to help with the diagnostic process.
These errors typically come down to two possibilities:
- Your web site is crashing without issuing an error. This happens, but it’s unlikely.
- Your web site is issuing a fatal error but your server or application configuration is preventing it from being displayed. This is more common, and luckily, easier to remedy.
Why These Errors Occur
A blank page can be caused by virtually any web site error, depending on your configuration. This is what makes them frustrating – there’s no single cause for a blank page error that separates it from the typical problems that often occur with web applications and servers.
The error might come from your CMS, a theme, a plugin, or any piece of code on your web site. The problem could be a simple bug in the code, inability to connect to a database or other external service, or a server configuration issue. One common problem is exceeding your PHP memory limit – some hosts may have this set fairly low.
It could also be that there’s nothing wrong with your web site or your server individually, but there is an incompatibility or conflict that arises when you put them together. Hosts regularly update their server software, and this is known for breaking web sites that have not been updated for compatibility with the latest server software. Or the inverse, when moving to a new server, your server software may be too old to support your code.
Last but not least, your underlying issue could be related to malware. The malware may be intended to break your site, or you may have an error come up as a side effect of an action performed by the malware.
How To Diagnose These Errors
These are just a few of the techniques I use for my web site repair service.
Increase the PHP Memory Limit
This error is often the result of PHP exceeding its memory limit. When a PHP script runs, it requires a certain amount of memory to execute. However, depending on server configuration, the PHP engine limits this, to prevent buggy scripts from consuming all available memory.
Sometimes hosts will set the memory limit low by default, 32MB or 64MB. We recommend setting your memory limit to 256MB for WordPress. You can do this by adding this line to the bottom of your wp-config.php file:
If you’d like to see your current memory limit, create a file called memorylimit.php in your public_html folder with the following code and load it from your web site (http://yourdomain.com/memorylimit.php):
<?php echo ini_get('memory_limit');
Check the Web Server Error Logs
If you’re on most hosting providers, your web server is Apache and your control panel is cPanel. Luckily, cPanel provides access to a log of Apache generated errors in the user interface. In the latest version of cPanel, you can access the logs by clicking the “Errors” icon in the “Metrics” section, as shown below.
This will bring you to a screen that shows a list of the latest errors. Note that some errors (such as 404 error referencing your favicon.ico file) are not fatal, and just because there is an error here, it doesn’t necessarily mean it’s the cause of your problem. I pulled this up for one of my sites as shown below.
In my case, it’s indicated that there was an error allocating memory. What this probably means is that I need to talk to my hosting company about increasing my memory limits.
If you’re not on cPanel and/or you’re running something other than Apache, there are other logs you can check. You may be using another HTTP server, such as NGINX. You may also want to check the logs for your other servers, such as MySQL.
You can read this article for some information about accessing your error logs on a bare Linux system without a control panel.
Check the PHP Logs
One of the most common causes of a blank page error is a PHP error being triggered on a server where PHP is configured not to display errors. On many hosting platforms, this is done for security reasons, as error messages will often contain sensitive information that should not be exposed to the general public.
If this is the case, PHP will often log errors to a file called error_log in the directory of your PHP script. Check if this file exists, and you may find your error there.
You can access this file from the cPanel file manager, or over FTP. In most cases, it will be directly in your public_html folder, but if your PHP script is in another directory, it will be there.
Here’s what the file looks like. Note that in my case, I triggered an error on purpose just to generate this file, and this particular error is just a Notice level error (PHP errors are usually called Notice, Warning or Error and only Error is fatal).
Some CMS platforms allow you to control your error reporting from the CMS’s configuration file.
For example if you’re using WordPress, you can turn on debugging in the wp-config.php file to display errors that would have been suppressed by the default configuration. Open your wp-config.php and change “false” to “true” this line:
If you’re not using a CMS, or your CMS does not have a debugging option, you can enable more verbose error logging in the PHP engine itself.
On some hosting platforms, you can turn on PHP’s display_errors setting from cPanel or using an .htaccess file, if your host allows it. Note that the process for doing this may vary per hosting company, and some may not allow you to change these settings. In this case, you can add a few lines of PHP to the beginning of your script and see if that works, as such:
error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE);
After doing one of the above, refresh your site and see if an error is displayed on the front end.
Trial and Error
Most web sites use CMS platforms. Many of these CMSes are modular, meaning they are composed of a core application along with separate plugins and themes. If all else fails, you can try disabling these plugins or themes one by one, and if the error is contained to one of them, you can use this technique to at least narrow down the issue.
This can be time consuming however, and we generally only recommend it as a last resort.