FAQ / PHP

PHP errors: how to display them and find the cause

‹ PHP

When a PHP application hits an error, you will see either an empty white page or a 500 error. The cause can be recognized from the error message. On a live website, however, that message is hidden for security reasons and saved to a log.

1. Check the error log

You can find the latest errors in the website's error log. If you do not have access to it or cannot see it, write to us and we will send you the last few lines. The line with the error contains the error type, description, file, and line number.

2. Turn on debugging in the application

WordPress: in the wp-config.php file, set:

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

Errors are then written to the file wp-content/debug.log and are not shown to visitors.

Your own PHP script: you can temporarily add this at the beginning of the file:

ini_set( 'display_errors', '1' );
error_reporting( E_ALL );

Once you find the error, always remove these lines. Displayed errors reveal paths and server details.

The most common messages

Parse error / syntax errorAn error in the code syntax (a missing semicolon or bracket). Often after manually editing a file.
Call to undefined functionThe function does not exist. An extension is missing, or the function was removed in that PHP version. See Moving to a newer PHP version.
Class not foundThe class was not loaded. Often incompletely uploaded files or a missing library.
Allowed memory size exhaustedThe memory limit was used up. See PHP memory limit.
Maximum execution time exceededThe script ran for too long. For large imports, process the data in parts.
Uncaught TypeErrorA function received a different type of value than it expected. Typically after moving to a newer PHP, where checks are stricter.

What to do when you do not know what happened

  1. Remember what changed right before the problem: an update, a new plugin, a PHP version change.
  2. Revert the change (turn off the plugin, switch the PHP version back).
  3. Then turn on debugging and fix the cause.

Other types of website errors are described in the article Errors 403, 404, and 500.

Still not sure what to do?

Write to us and we will solve it together.

Contact support ›