Your SlideShare is downloading. ×
WebElement #2 - Xdebug, debugging PHP applications
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

WebElement #2 - Xdebug, debugging PHP applications

1,578
views

Published on

http://www.webelement.sk/event/webelement-2

http://www.webelement.sk/event/webelement-2

Published in: Education, Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,578
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Xdebugdebugging PHP applications WebElement event #2, 08.12.2011 Vladimír Kriška, @ujovlado
  • 2. “I Dont Need A Debugger”● Chuck Norris doesnt● for everyone else is XdebugThese functions are insufficient: ● echo ● print_r() ● var_dump()… or yours framework built-in functionsAnd you probably use them with <pre> tag.
  • 3. Xdebug● Open Source debugging tool https://github.com/derickr/xdebug● Easy to configure● Easy to use● Works on every platform● Nice, colored output
  • 4. Initial configuration● html_errors = On● zend_extension=/path/to/xdebug.so e.g.: /usr/lib/php5/20090626/xdebug.so
  • 5. Lets startHow 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.
  • 6. Example code
  • 7. Output
  • 8. Stack trace - code
  • 9. Stack trace - output
  • 10. Function trace - code
  • 11. Function trace - output file
  • 12. Code coverageDetect which lines of script was executed.Three functions: ● xdebug_start_code_coverage() ● xdebug_stop_code_coverage() ● xdebug_get_code_coverage()
  • 13. Code coverage - code
  • 14. Code coverage - output
  • 15. Tracefile analyserSet xdebug.trace_format=1tracefile-analyser.php tracefile.xt [sortkey][elements]Available sortkeys: ● calls ● time-inclusive ● memory-inclusive ● time-own ● memory-own
  • 16. ProfilingSet:xdebug.profiler_enable=1xdebug.profiler_output_dir=/var/www/xdebug/tmpGenerates cachegrind file.Tools: ● KCachegrind ● Webgrind
  • 17. Debuggingxdebug.remote_enable=1xdebug.remote_handler=dbgpxdebug.remote_mode=reqxdebug.remote_host=127.0.0.1xdebug.remote_port=9000
  • 18. “Scream” modexdebug.scream=1Set this to disable the “@” operator. All errors,warnings and notices will be visible.
  • 19. Some new features in 2.2xdebug.cli_color- colored output in CLI modexdebug.coverage_enable- if you turn this off, it speeds up Xdebug, butcoverage analysis wont work
  • 20. ResourcesXdebug home page- http://xdebug.org/Derick Rethans- http://derickrethans.nl/
  • 21. Thank you! Any questions?