WebGee DocsDocs
Development
Free migration + 30-day money-backSee how

Enable error logging in PHP

Turn on error reporting to diagnose a blank page — to a log file, never to the browser on a live site.

Make PHP record errors so you can see what is failing. Applies to shared, reseller and Premium hosting.

A blank white page almost always means a fatal error with display disabled. Logging is how you see it.

Never enable display_errors on a live site. Error messages reveal file paths, database names and sometimes credentials, and attackers read them deliberately. Log to a file instead — the information is identical and only you can see it.

For one script

Add at the very top, before any other code:

<?php
ini_set('log_errors', 1);
ini_set('error_log', __DIR__ . '/error_log');
error_reporting(E_ALL);

Errors are written to error_log beside the script. Read it as described in Find your error log.

For the whole account

cPanel → Select PHP Version → Options:

SettingValue
log_errorsOn
error_reportingE_ALL
display_errorsOff — leave it off

See Change your PHP version and settings.

WordPress

Edit wp-config.php, above /* That's all, stop editing! */:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

Errors go to wp-content/debug.log.

WP_DEBUG_DISPLAY set to false is what keeps them off the page. Enabling WP_DEBUG alone shows errors to visitors — see Enable WP_DEBUG.

Debugging on a live site

If you must, restrict output to your own IP:

if ( $_SERVER['REMOTE_ADDR'] === '203.0.113.10' ) {
    ini_set( 'display_errors', 1 );
    error_reporting( E_ALL );
}

Remove it once finished.

Turn it off afterwards

Verbose logging writes on every request. Leaving E_ALL on a busy site produces a log file large enough to affect your disk quota, and the noise buries anything real.

On this page

Hosted elsewhere?

Cloud Hosting

cPanel on NVMe storage, with LiteSpeed, free SSL and daily backups included.

See plansFree migration