Knowledgebase

Reading and Fixing PHP Errors Print

  • developersgitdeployment, developers, php, troubleshooting, errors, uploads, guide, howto
  • 0

Interpreting what the log tells you.

THE TYPES

  • Parse error: a syntax mistake. The file will not run at all. Names the file and line.
  • Fatal error: something the code cannot continue past, such as calling a function that does not exist.
  • Warning: something wrong that did not stop execution.
  • Notice and Deprecated: informational, but deprecations predict breakage on the next PHP version.

READING ONE

The message names the problem, the file and the line. Start there.

A stack trace, where present, shows how execution reached that point. Read from the bottom up to understand the path.

COMMON CAUSES

Calling a function removed in a newer PHP version A missing file after an incomplete upload A missing PHP extension Memory or execution time exhausted A type error after a PHP version change

CHECKING SYNTAX WITHOUT RUNNING

php -l against the file reports parse errors without executing it. Useful before deploying an edit.

AFTER A PHP VERSION CHANGE

Deprecation notices become fatal errors in later versions. Read them before upgrading rather than after.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot