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.

Guide2 min readLast updated
On this page
  1. Error types, from most to least serious
  2. What to do with each
  3. Common fatal errors
  4. Where errors go

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)

Prefer to follow along?

Not with Traxio yet? You can try this on a real server with our PHP hosting: £0.99 a month.

Spotted something out of date or unclear? Tell us and we’ll fix it.

Keep going