Understanding PHP error messages

How to read a PHP error: fatal errors, parse errors, warnings, notices and deprecations, what each means for your site, and where to look next.

ExplainerIntermediate2 min readUpdated

PHP errors look intimidating, but they follow one pattern: type, message, file, line.

PHP Fatal error:  Uncaught Error: Call to undefined function mb_strlen() in /home/user/domains/yourdomain.co.uk/public_html/lib/text.php:42
  • Type: Fatal error
  • Message: Call to undefined function mb_strlen()
  • File: lib/text.php
  • Line: 42

Error types, from most to least serious

TypeEffectExample cause
Parse errorNothing in that file runsA missing ; or bracket after an edit
Fatal errorScript stops — blank page, 500 or critical errorUndefined function, out of memory, uncaught exception
WarningScript continues, but something failedFile not found, division by zero
NoticeScript continues; possible bugUndefined variable or array key
DeprecatedWorks now, will break in a future versionOld syntax or removed-soon functions

What to do with each

  • Parse and fatal errors break the site. Fix these first.
  • Warnings deserve investigation if something isn’t working.
  • Notices and deprecations can wait, but plan to address deprecations before upgrading PHP.

Common fatal errors

Where errors go

Visitors shouldn’t see errors. They should be logged. How to find PHP errors (error logs and display_errors)

Not with Traxio yet? You can try this on a real server with our free PHP hosting trial: 30 days free with no card, then £0.99 a month.

Popular

Tip: press / to search from any pageSee all results