Blank page - The White Screen of Death

Sometimes you load a URL on your site and are presented with a blank white page. No contents. No errors. Nothing.

For dramatic effect we refer to this as 'The White Screen of Death'

The issue is probably memory. Traditionally, this has most often been a problem showing up (or rather not showing up) in the modules admin screen.This issue has pretty much been solved for that page; however, there are still instances in other modules (usually admin actions like bulk updates) where PHP memory can be exhausted.

Try the solutions here first although I'd probably prefer a limit of 20M for intense sites rather than the version-4.6 value of 12M. This is also described in 'basic site configuration' (you did read that, right?)

Next confirm that the change has had an effect with a phpinfo() page. If you are hosting the site and it didn't work, check that you were modifying the correct php.ini file (it's named in the phpinfo). If your site is hosted by someone else and you failed to increase the memory limit, then your host has probably locked it down (for good reason) and you'll have to negotiate with them. There may be a few work-arounds to try, like creating a custom php.ini but it will vary from host to host. Search Drupal for other folk's experiences.

"Invisible" Errors

There is at least one other possible cause for a white screen. You could be getting a fatal error with error_reporting turned off. The most common code error that causes WSOD is having additional whitespace at the end of a PHP file. To avoid this issue it is Drupal coding standard to not include the closing ?> on a PHP file.

Log Files

Try to find your log files. This will vary depending on your host, but it's good to know what and where they are. On my Unix Shell, the easy thing to do is:

tail /var/log/apache2/error.log

To check that you are looking at the right file, you may wish to type...

grep 'ErrorLog' /etc/apache2/*
grep 'ErrorLog' /etc/apache2/*/*

... to find where the logfiles are.

You will get seriously different results on different hosting environments, but this is a start.

Enable error reporting

Although it may be turned off (for good reason) on commercial hosts, it's not much good not being able to troubleshoot. For serious forensics, temporarily edit your index.php right at the top to include

<?php
error_reporting
(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

/**
* @file
*/
....
?>

This may help, it sends errors to the screen instead of just vanishing. Memory problems may continue to just vanish, but it's a process of elimination.

Module and theme name clashes

Another possible cause for a blank page is a name clash, i.e. a module and a theme are using the same name. For example, if module 'foo' implements hook_block() with foo_block() and there is also a theme 'foo', then the theme engine will invoke foo_block() as the theme function to render a block. While foo_block() might not trigger a WSOD, foo_page() will.

No error messages are produced, because this is a wanted behaviour of Drupal's theme system.

Solution: In most cases, either the module or the theme (or both) are custom (created by yourself). Rename it.

Remove $db_url variable from settings.php

Uersu - May 3, 2008 - 16:12

If this happens during installation or when starting a multi-site configuration, the reason may also be in the settings.php file in the site/ directory. I found an old comment explaining: "This happens if you have already edited the $db_url variable in settings.php. The installer will no longer be automatically invoked, because Drupal assumes installation has already been completed."

So, if you e.g. get the following error messages (e.g. on Drupal 6.x), the above may be the reason:
PHP Warning: Table 'testing.access' doesn't exist
query: SELECT 1 FROM access WHERE type = 'host' AND LOWER('127.0.0.1') LIKE LOWER(mask) AND status = 0 LIMIT 0, 1 in C:\\My_webdev\\htdocs\\drupal\\includes\\database.mysql.inc on line 128
PHP Warning: Table 'testing.users' doesn't exist
query: SELECT u.*, s.* FROM users u INNER JOIN sessions s ON u.uid = s.uid WHERE s.sid = 'da5qecc9rsf1dinhb4ko1e5dm0' in C:\\My_webdev\\htdocs\\drupal\\includes\\database.mysql.inc on line 128
PHP Warning: Table 'testing.cache' doesn't exist
query: SELECT data, created, headers, expire, serialized FROM cache WHERE cid = 'variables' in C:\\My_webdev\\htdocs\\drupal\\includes\\database.mysql.inc on line 128
PHP Warning: Table 'testing.variable' doesn't exist
query: SELECT * FROM variable in C:\\My_webdev\\htdocs\\drupal\\includes\\database.mysql.inc on line 128
PHP Notice: Undefined variable: variables in C:\\My_webdev\\htdocs\\drupal\\includes\\bootstrap.inc on line 427
PHP Warning: Table 'testing.cache' doesn't exist
query: UPDATE cache SET data = '', created = 1209809924, expire = 0, headers = '', serialized = 0 WHERE cid = 'variables' in C:\\My_webdev\\htdocs\\drupal\\includes\\database.mysql.inc on line 128
PHP Notice: Undefined variable: variables in C:\\My_webdev\\htdocs\\drupal\\includes\\bootstrap.inc on line 434
PHP Warning: Table 'testing.system' doesn't exist
query: SELECT name, filename, throttle FROM system WHERE type = 'module' AND status = 1 AND bootstrap = 1 ORDER BY weight ASC, filename ASC in C:\\My_webdev\\htdocs\\drupal\\includes\\database.mysql.inc on line 128
PHP Warning: Table 'testing.url_alias' doesn't exist
query: SELECT COUNT(pid) FROM url_alias in C:\\My_webdev\\htdocs\\drupal\\includes\\database.mysql.inc on line 128

rebuilding permissions on big sites

enboig - June 13, 2008 - 13:00

I was getting white screen when trying to update; so I finally used this script to update the permission table:

<?php
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
user_authenticate('admin', 'admin');
$actual=db_result(db_query("SELECT nid FROM {node} WHERE nid > %d ORDER BY nid",$_GET['node']));
if (
$actual>0) {
 
$sencer=node_load($actual);
 
node_access_acquire_grants($sencer);
}
?>
<html>
<head>
<script type="text/javascript">
<!--
function delayer(){
    window.location = "rebuild_permissions.php?node=<?=$actual?>"
}
//-->
</script>
</head>
<body <?=($actual>0 ? " onLoad=\"setTimeout('delayer()', 500)\"" : "") ?>>
<?php
if ($actual>0) echo "doing... ".$actual;
else echo
"Done";
?>

</body>
</html>

whitespace before <?php

yhager - June 22, 2008 - 14:22

Check Drupal log for errors '/admin/logs/watchdog', and look for 'headers already sent' error. The error might have a clue on where to look - in my case this was a whitespace before <?php, at the beginning of 'template.php' file.

--yuval

Check your server settings

Steve Dondley - July 5, 2008 - 19:28

I had a blank index.html document in my Drupal directory and apache was not configured to search for index.php files with the DirectoryIndex directive. It looked like a white screen of death but it was just an empty web page! I was able to figure this out but I could imagine a newbie getting totally lost.

Moral: contact someone who is experienced running web servers if you are stumped.

--
Prometheus

Include paths may cause this also!

gggdrpl - July 9, 2008 - 06:50

I have to create a new website which is planned to be very similar to another one I've recently built. I figured out that I could copy all the files and DB from this existing site to the location of the new site, that will be hosted in a different server. But after all the files were uploaded and DB was imported, and of course settings.php got edited, all I got was a blank screen, no errors at all.

I went editing my index.php as suggested above and noticed that pathauto module was throwing fatal errors because of missing includes.

Adding this line to the .htaccess file solved the problem instantaneously:

php_value include_path '.:/var/www/vhosts/example.com/httpdocs'

Right base path for your own server may be obtained through info.php or logging into your control panel.

Maybe some folks will have the same idea about cloning a site to construct another lookalike and save a lot of time and effort. A multisite setup wasn't a viable option in this case so this approach was the best I could think of. Drupal 5.7 is the version I used for this.

Hope this helps!

 
 

Drupal is a registered trademark of Dries Buytaert.