PHP Debugging Techniques

When it comes to debugging, what experience teaches you most is the causes of certain types of errors. Knowing this makes fixing the error much, much faster. To shorten the chase, Table 6.3 lists the likely reasons for the most common PHP errors.

Table 6.3. These are some of the most common errors you’ll see in PHP, along with their most probable causes.
Common PHP Errors
ErrorLikely Cause
Blank PageHTML problem, or PHP error and display_errors is off.
Parse errorMissing semicolon; unbalanced curly braces, parentheses, or quotation marks; or use of an unescaped quotation mark in a string.
Empty variable valueForgot the initial $, misspelled or miscapitalized the variable name, inappropriate variable scope (with functions), ...

Get PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.