White Screen of Death / Blank Screen with ExpressionEngine
White Screen of Death
When building sites in ExpressionEngine locally you are always going to run into issues of some extent at a point in time. We say locally as thats the way to build sites. Locally means that we build on our own computer rather than a live, staging or production server or hosting. Why? because its a lot quicker, than transferring files then checking things. Even when editing very small bits of sites its always best to get it running on a local server first and checking it there, then deploying those changes onto the site live.
Anyway this post isn't about development servers, it's about white screens in ExpressionEngine. When you come across a white screen it's like being lost in a wood at night with it being pitch black. You are completely blind and you have no idea where to go. You absolutely have to find a torch. That torch is showing the php or mysql error. To do that is usually very straight forward.
In index.php in the root directory of the site you will see an variable that says
You want to change that to
If you are seeing this error on the control panel then you want to change this in the admin folder( named of your choice and system by default). Index.php is the file you want to change. If you are not logged in then you can set this to debug=2; which should override the logged in setting, its not advised for security but it works when you are evaluating efficiency versus security.
Generally you will find that its a php or mysql error and seeing these exact errors will point you in the right direction of finding the problem.
There are other situations that can catch you out an even with errors turned on and visible you will still get a blank screen. When setting your template path make 100% sure there are templates in that path and the path is correct. If not you will get a blank site and no errors. It's easy to get stuck on this overlooked area and one of the first, if not the first thing to check when you see a blank screen on a new install or a site you are coming back to. We always set our template paths in config.php in the admin directory so it can be overridden locally. ( journal post for another day)
Even when you are up and running with a live site, with everything tested, you can intermittently run into problems. In our experience this has normally been a memory issue with pages with high loads such as image galleries. Turing on errors you will see this. Depending on your server setup its then normally a case of getting your web host to increase the php memory or indeed setting that yourself via .htaccess or php.ini.
So the steps to follow if you come across a white screen
- Check template path is 100% correct
- Turn on php errors via debug variable in index.php in the root directory or index.php in the “system” [should be renamed and different for each reader] directory if the white screen happens on the control panel / admin section.
- If on a live site, again get errors via debug variable, if a gallery / image site then indicator would be php memory needs to be increased.
This is not by any means an extensive blog post on white screens and php errors with EE but even experienced ExpressionEngine developers can overlook these simple steps, at times of panic.