A blank page in PHP: how to see the error

A white page means PHP hit a fatal error and is set not to show it. That is the right setting for a public site, which is why the error exists but you do not see it. The answer is not to make the error appear to everybody: it is to go and read it where it is recorded.

Reading the error, in order of effort

1 Look for the error_log file. By default PHP writes to a file called error_log in the folder of the script that failed. In the File Manager, open the site folder and the application folders, sort by date and open the newest. The last line is usually the answer.
2 Check cPanel’s log. The Errors tool shows the site’s most recent errors. See where the PHP error log is and how to read it.
3 If you find nothing, show the error for a minute. Create a .user.ini in the folder with the two lines below, wait a few minutes, reload the page, and delete the file straight afterwards.

display_errors = On
error_reporting = E_ALL

If you have a command line (see the cPanel Terminal), php -l file.php checks a file for syntax errors without running it.

What is usually behind it

The last line of the log says… Cause Go to
Allowed memory size … exhausted The request used more memory than the limit. Memory exhausted
Maximum execution time … exceeded The script took too long. Execution time
Call to undefined function An extension is missing on this PHP version. The missing extension
Parse error / syntax error A typo in the code: a bracket, a semicolon. Fix the line it names, or restore the file’s previous copy.
Cannot redeclare / Uncaught Error Two plugins or files defining the same thing, or code that does not fit this PHP version. Changing the PHP version

If the white screen is a WordPress one, it has its own route: switch on debug mode in wp-config.php with define('WP_DEBUG', true);, define('WP_DEBUG_LOG', true); and define('WP_DEBUG_DISPLAY', false);, and read the wp-content/debug.log file. See also common WordPress errors.

A detail that misleads: there is one error_log per folder where PHP failed. The error from an admin page may sit in a different file from the site root’s, so look inside the subfolders too, such as the administration area’s.

Never leave display_errors on for a public site. The messages show file paths and sometimes database connection details. Switch it on to read the error, and switch it off the next minute.
Did you change something just before the page went white? A new plugin, a PHP version, an edited file: undo that single change first. Often the problem disappears and reading the log can wait.

Seen the log and cannot make sense of the message? Send us the last line of the error_log and the page’s address.

Open a support ticket

SEE ALSO

Where the PHP error log is, how to read it, and the errors you will see most

Common WordPress errors: white screen, critical error and how to find the cause

PHP warnings showing on your site: what they are

Website errors explained: 500, 403, 404, 508

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $6.59/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?