Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Xdebug / debugging PHP applications (WebElement #2)

Xdebug / debugging PHP applications (WebElement #2)

Vladimír Kriška

December 08, 2011
Tweet

More Decks by Vladimír Kriška

Other Decks in Programming

Transcript

  1. “I Don't Need A Debugger” • Chuck Norris doesn't •

    for everyone else is Xdebug These functions are insufficient: • echo • print_r() • var_dump() … or your's framework built-in functions And you probably use them with <pre> tag.
  2. Xdebug • Open Source debugging tool https://github.com/derickr/xdebug • Easy to

    configure • Easy to use • Works on every platform • Nice, colored output
  3. Let's start How much to show: • xdebug.var_display_max_children (128) •

    xdebug.var_display_max_data (512) • xdebug.var_display_max_depth (3) Xdebug overloads var_dump() by default.
  4. Code coverage Detect which lines of script was executed. Three

    functions: • xdebug_start_code_coverage() • xdebug_stop_code_coverage() • xdebug_get_code_coverage()
  5. “Scream” mode xdebug.scream=1 Set this to disable the “@” operator.

    All errors, warnings and notices will be visible.
  6. Some new features in 2.2 xdebug.cli_color - colored output in

    CLI mode xdebug.coverage_enable - if you turn this off, it speeds up Xdebug, but coverage analysis won't work