Drupal - White Screen Of Death

2019-07-07 06:09发布

问题:

Just changed themes with drupal and I'm left with white screen of death. Default theme which worked was Zen. This is stored under sites/mysite.com/themes Theme I changed to I think is one of the themes under themes/ Don't have access to the database. Have FTP access. Is there any way to change themes or install one that will work?

回答1:

The easiest way to correct your problem is to find what's wrong.

go to index.php and add the following lines after <?php

ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);

Then post the error here. Don't forget to comment/remove when you're done.

EDIT:

If I understood correctly this was what you did before going WSOD.

  1. You were using Zen theme.
  2. You logged into your site with administrator privileges and went to http://yoursite.com/admin
  3. You went to the theme management and changed your theme to another one (henceforth refered as "theme_b")
  4. When refreshed the page (or went to another page in your site) you got the WSOD.

.

If this is true then follow these steps:

Create a blank theme. In order to do this, create a folder in your computer named "theme_b".

Inside create the following files: theme_b.info, template.php, style.css and page.tpl.php

Open theme_b.info and paste this:

name = theme_b
description = bla
version = 1
core = 6.x
engine = phptemplate
stylesheets[all][] = style.css

Save.

Open page.tpl.php and paste this:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <?php print $head ?>
    <title><?php print $head_title ?></title>
    <?php print $styles ?>
    <?php print $scripts ?>
</head>
<body>
<div><?php print theme('links', $primary_links, array('class' => 'links primary-links')) ?></div>
<div><?php print theme('links', $secondary_links, array('class' => 'links secondary-links')) ?></div>
<div id="sidebar-left" class="sidebar"><?php print $left ?></div>
<div>
<?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif; ?>
<?php if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?>
<?php if ($tabs): print '<ul class="tabs primary">'. $tabs .'</ul></div>'; endif; ?>
<?php if ($tabs2): print '<ul class="tabs secondary">'. $tabs2 .'</ul>'; endif; ?>
<?php if ($show_messages && $messages): print $messages; endif; ?>
<?php print $help; ?>
</div>
<div>
<?php print $content; ?>
</div>
</body>
</html>

Save.

Then upload the folder theme_a to sites/yoursite.com/themes replacing existing theme_a folder.

This should enable you to access admin section of drupal.



回答2:

You won't necessarily see any errors. For me it was a caching issue which stopped the page from loading the right content.

I cleared the cache by inserting the following on the last line of my index.php file (in Drupal root). This solved the issue for me:

db_query("DELETE FROM {cache};");

Remember to remove the line again afterwards.

More information about caching, look here: https://drupal.org/node/42055



回答3:

It's most probably a PHP silent death because there's not enough memory allocated to scripts in /etc/php.ini

On shared hosting environments, you MAY be able to override this using a .htaccess file.



回答4:

You more than likely have a PHP error that isn't being shown because error reporting is turned off by default on your host. The easiest way to remedy this is to add the following code at the top of index.php:

<?php

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

Additionally, you definitely want to locate your php error logs and see if there is any additional information regarding the error there.

Checkout the Drupal help page for this topic: http://drupal.org/node/158043



标签: drupal