18

CiviCRM is showing a blank page (aka white screen of death or WSoD) when I expect to see some output.

How can I debug CiviCRM when there is no error message visible on screen?

This includes when the error message on screen simply says "Error 500" but includes no details about the nature of the problem.

2 Answers 2

20

A white screen (WSoD or "white screen of death") indicates that PHP is configured not to display errors, and has hit an error which it can't recover from. The result is an empty page.

Your next step is not to fix the error, but to first give yourself enough information to identify the source of the error. (Diagnose, then treat.)

Viewing errors in logfiles

The webserver can be configured to display errors to screen, but it also logs errors to files on disk. These files vary depending on your hosting environment, so you might consult your webhost's documentation to locate them. You might look for errors in some of these locations depending on webserver/php config -

/var/log/nginx/*err*log       # NginX webserver error logs
/var/log/apache2/*err*log     # Apache webserver & mod_php error logs
/var/log/*php*log             # PHP-FPM & PHP-CGI error logs
/var/log/php5/*log            # PHP-FPM & PHP-CGI error logs
/path/to/site/err*log         # Some hosting environments

And a CiviCRM specific debug log file - location varies depending on hosting environment and CMS, refer to this wiki page for location -

path/to/site/path/to/civicrm/files/ConfigAndLog/CiviCRM*log

(The *s above represent a wildcard, not an actual filename. Eg the last entry might be public_html/error_log on Bluehost.)

Once you've located these files, you can download them to view, or you can use tools like tail or less +F to follow the files. I prefer to follow logfiles because you can watch the error appear each time.

Displaying errors to screen

You may prefer to display errors to screen. This is probably disabled on your site because it's a security risk to some degree - an attacker can see more information when errors are visible, so the default configuration is often to restrict visibility to people with server access (via the logfiles above).

To enable error display, either:

Configure your PHP to display errors for your site via php.ini / .htaccess (see How can I get PHP errors to display), OR

Add PHP code to enable error display (you can add it in civicrm.settings.php or the top of the index.php of your host CMS).

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

Making sense of what you see

Once you've taken one of the above approaches, try reproducing the actions which led to a white screen. If all's gone well, you should see an error now (on screen, or in your terminal / SSH session).

This is where you can start debugging meaningfully. There's a good chance you're exhausting server resources (timeouts, memory exhaustion) or hitting some coding error, but once you have the relevant error message at hand you'll be much better equipped to track down the source of the problem affecting your site.

Further reading

Notes

If this is the first time you've looked, there may be other errors visible which don't relate to the problem at hand. You may still need to discern what the actual problem is ...

If you're not familiar with UNIX, this may seem like a lot of effort. It's a lot less effort than guessing your way through a problem though!

4
  • 1
    Feel free to edit this answer to improve it. I posted this originally on civicrm.stackexchange.com/questions/2798/… but have created a generic question and re-posted so we don't confuse people when referring to it there. Sep 14, 2015 at 3:12
  • A life saver for me! Many thanks. Can the lines I put in civicrm settings stay there? These lines, I mean: error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE);
    – Andy Clark
    Nov 2, 2019 at 10:34
  • @Andy Clark that's helpful for you to debug but it's not recommended for production as it shares error "noise" with your customers and potentially too much information with an attacker. I'd recommend leaving those settings enabled only on a development server, see Displaying errors to screen above. Nov 16, 2019 at 17:33
  • Thanks, Chris, I took those lines out
    – Andy Clark
    Nov 16, 2019 at 17:45
0

Another option of seeing the civi logs is adding the extension CiviCRM Log Viewer which gives a link via the Admin menu to view the error log

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.