twerple logo
Loading experience...
twerple logo

Showing PHP errors while you fix your website

1 min read • Updated 2 weeks ago • Websites, PHP & Performance

Turn on error messages to find the cause of a blank page or a 500 error, and turn them off again.


A blank white page or a "500 Internal Server Error" usually hides a PHP error message. Showing the error tells you exactly which file and line is causing the problem.

Showing errors with .user.ini

  1. In HostPanel, open your domain, go to the PHP tab and open the .user.ini Editor. Or create a file called .user.ini in public_html with the File Manager.
  2. Add these lines:
    display_errors = On
    error_reporting = E_ALL
  3. Save, wait a minute, and reload your website. The error now appears on the page.

Turn this off again as soon as you have found the problem, by changing On to Off. Error messages can show visitors sensitive details about your website.

WordPress

In WordPress, edit wp-config.php and set:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Errors are then written to wp-content/debug.log instead of shown to visitors. Set WP_DEBUG back to false when you have finished.

Need the server's error log?

Open a support ticket with your domain and roughly when the error happened, and we will send you the relevant lines from the server logs.

Was this article helpful?