Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
PHP DEBUGGING
BEYOND ECHO
PHP MESSAGE TYPES
• Notice – not a best coding practice
• Warning – will probably cause errors upon execution
• Error – fa...
COMMON PHP ERROR LEVELS
Referenced by constants representing bit level integers to the interpreter
• E_ERROR – fatal run-t...
DISPLAYING ERRORS
• error_reporting – sets level via constant
• Default: all except E_NOTICE
• display_errors – displays e...
SCRIPT LEVEL ERROR MANAGEMENT
LOGGING ERRORS
• log_errors – toggle error logging
• Default: off
• log_errors_max_len – length of error message in bytes
...
DISPLAYING ERRORS
• error_reporting – sets level via constant
• Default: all except E_NOTICE
• display_errors – displays e...
TRIGGER_ERROR
DEBUG_BACKTRACE
• backtrace – sequence of function/method calls
• invaluable in debugging frameworks/complex structures
• ...
Php debugging
Upcoming SlideShare
Loading in …5
×

Php debugging

3,290 views

Published on

An overview of basic fundamental php debugging concepts meant to be accompanied by real world examples on a live or local web server

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Php debugging

  1. 1. PHP DEBUGGING BEYOND ECHO
  2. 2. PHP MESSAGE TYPES • Notice – not a best coding practice • Warning – will probably cause errors upon execution • Error – fatal (crash) • Occur when script is interpreted (no execution - e.g., “The white screen of death”), or at script execution (run-time error halts execution)
  3. 3. COMMON PHP ERROR LEVELS Referenced by constants representing bit level integers to the interpreter • E_ERROR – fatal run-time error (crash) • E_WARNING – run-time warning • E_NOTICE – run-time notice • E_STRICT – interpretation-time notice • E_DEPRECATED – run-time – will not work in future PHP versions • E_ALL – all notices, warnings, and errors
  4. 4. DISPLAYING ERRORS • error_reporting – sets level via constant • Default: all except E_NOTICE • display_errors – displays error to users (only use in development environment) • 1 or 0 – default is 1
  5. 5. SCRIPT LEVEL ERROR MANAGEMENT
  6. 6. LOGGING ERRORS • log_errors – toggle error logging • Default: off • log_errors_max_len – length of error message in bytes • default: 1024 • 0 is unlimited • error_log – full path to log file • default: NULL (goes to server error log; not a best practice) • set log file path outside of the web root
  7. 7. DISPLAYING ERRORS • error_reporting – sets level via constant • Default: all except E_NOTICE • display_errors – displays error to users (only use in development environment) • 1 or 0 – default is 1
  8. 8. TRIGGER_ERROR
  9. 9. DEBUG_BACKTRACE • backtrace – sequence of function/method calls • invaluable in debugging frameworks/complex structures • returns associative array – keyed in ascending order • lowest number - last execution • each contains function/method, line number, file, class, object, and arguments!

×