How To fix White Screen error in drupal ?

  0 comments
Share

Sometimes you navigate to a page and suddenly the page content disappears, and it becomes blank. No content, No errors, Nothing display.  It could happen generally after updating a module, theme, or Drupal core.

This generally happens due to amount of memory required to run a site using so much code. It is fairly easy to fix in most cases.

To enable error reporting, temporarily edit your index.php file in your root directory after the first opening PHP tag (do not edit the actual file info!) to add the following:

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

After inserting the code, load the same page that caused the error. If any PHP errors are causing the page to load they should be displayed on the screen. From there the PHP error might give you a better indication of what's causing Drupal to fail.

white Screen error

To see the current memory limit.

  • Go to /admin/reports/status/php
  • do a find (ctrl + f) for "memory_limit", this will show you a memory_limit field and its value like below image

    check_memory_limit

  • In my case, current memory limit is 32M. To fix this memory limit issue we need to increase memory limit.

To resolve memory issues, try the suggested 3 solutions below:

  1. Add memory_limit = 64M to your php.ini file

    if you have access to the server's php.ini.

    • Edit the memory_limit in the php.ini file (usually in a section called Resource Limits)

      memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

      If there is no section already for this, place the above line at the end of the file.
    • Restart Apache.

    if you havn't access to the server's php.ini.

    • Add php.ini in the Drupal root folder
    • Add the following line to a php.ini file in your Drupal root folder:

      memory_limit = 64M

  2. Add ini_set('memory_limit', '64M'); in your site's settings.php file

    you can edit sites/default/settings.php. Locate the PHP settings section and add the following line at the end of that section:

    ini_set('memory_limit', '64M');

  3. Add php_value memory_limit 64M in your .htaccess file in the Drupal root

    Add php_value memory_limit 64M to your htaccess would like this:

    # PHP 5, Apache 1 and 2. php_flag magic_quotes_gpc off php_flag magic_quotes_sybase off php_flag register_globals off php_flag session.auto_start off php_value mbstring.http_input pass php_value mbstring.http_output pass php_flag mbstring.encoding_translation off php_value memory_limit 64M

if you still can't solve the problem talk with your host/server admin about them increasing the limit for you.

Add new comment