Xdebug

download Xdebug

of 51

  • date post

    01-Sep-2014
  • Category

    Technology

  • view

    3.273
  • download

    8

Embed Size (px)

description

Slides from my Xdebug talk at PHP World Kongress 2009.

Transcript of Xdebug

  • Xdebug Alltagshilfe und professioneller Debugger TobiasSchlitt PHP World Kongress 2009 2009-11-24 Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 1 / 41
  • About me Tobias Schlitt PHP since 2001 Freelancing consultant Qualied IT Specialist Studying CS at TU Dortmund (nishing mid 2010) OSS addicted eZ Components PHPUnit Various other projects . . . Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 2 / 41
  • Overview 1 About Debugging 2 Installation 3 Development goodies 4 Tracing 5 More features... 6 The end Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 3 / 41
  • Outline 1 About Debugging 2 Installation 3 Development goodies 4 Tracing 5 More features... 6 The end Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 4 / 41
  • Why a debugger? I dont need a debugger No bug free code Living life the easy way . . . var dump(), print r() and echo Sometimes, yes Slow and a lot of work Using a debugger = using an IDE No, but you can Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 5 / 41
  • Why a debugger? I dont need a debugger No bug free code Living life the easy way . . . var dump(), print r() and echo Sometimes, yes Slow and a lot of work Using a debugger = using an IDE No, but you can Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 5 / 41
  • Why a debugger? I dont need a debugger No bug free code Living life the easy way . . . var dump(), print r() and echo Sometimes, yes Slow and a lot of work Using a debugger = using an IDE No, but you can Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 5 / 41
  • Why a debugger? I dont need a debugger No bug free code Living life the easy way . . . var dump(), print r() and echo Sometimes, yes Slow and a lot of work Using a debugger = using an IDE No, but you can Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 5 / 41
  • Why a debugger? I dont need a debugger No bug free code Living life the easy way . . . var dump(), print r() and echo Sometimes, yes Slow and a lot of work Using a debugger = using an IDE No, but you can Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 5 / 41
  • Why a debugger? I dont need a debugger No bug free code Living life the easy way . . . var dump(), print r() and echo Sometimes, yes Slow and a lot of work Using a debugger = using an IDE No, but you can Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 5 / 41
  • Why a debugger? I dont need a debugger No bug free code Living life the easy way . . . var dump(), print r() and echo Sometimes, yes Slow and a lot of work Using a debugger = using an IDE No, but you can Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 5 / 41
  • Why a debugger? I dont need a debugger No bug free code Living life the easy way . . . var dump(), print r() and echo Sometimes, yes Slow and a lot of work Using a debugger = using an IDE No, but you can Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 5 / 41
  • Why a debugger? I dont need a debugger No bug free code Living life the easy way . . . var dump(), print r() and echo Sometimes, yes Slow and a lot of work Using a debugger = using an IDE No, but you can Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 5 / 41
  • Why a debugger? I dont need a debugger No bug free code Living life the easy way . . . var dump(), print r() and echo Sometimes, yes Slow and a lot of work Using a debugger = using an IDE No, but you can Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 5 / 41
  • What is Xdebug? Open Source debugger for PHP PHP (Zend Engine) extension Works (at least) on Linux, Mac and Windows About 5 years old Current stable version: 2.0.5 Created and maintained by Derick Rethans http://xdebug.org Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 6 / 41
  • Xdebug features Enhance daily work with PHP Trace PHP program runs Prole PHP applications Analyze code coverage (e.g. PHPUnit) Remote-debugging with an external client Including break-points, stepping, . . . Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 7 / 41
  • Outline 1 About Debugging 2 Installation Installation Conguration 3 Development goodies 4 Tracing 5 More features... 6 The end Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 8 / 41
  • Via PEAR Easiest way to install Working PEAR assumed: $ pear install pecl/xdebug PEAR Installer performs necessary steps: 1 Download source 2 Compiling module 3 Copying module to destination After that: Add module to php.ini Only on *nix systems Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 9 / 41
  • Manual Compile by hand Typical PHP module compile process wget h t t p : / / xdebug . o r g / l i n k . php ? u r l=xdebug205 t a r x z f xdebug 2 . 0 . 5 . t g z cd xdebug 2 . 0 . 5 phpize . / c o n f i g u r e enable xdebug w i t h phpc o n f i g =/ u s r / b i n / phpc o n f i g make cp m o d u l e s / xdebug . s o //xdebug . s o After that: Add module to php.ini Only on *nix systems Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 10 / 41
  • Windows Download binary module from http://xdebug.org Copy to modules directory After that: Add module to php.ini Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 11 / 41
  • Add module to php.ini Not a normal extension Add to php.ini: zend extension = /path/to/xdebug.so For threadsafe builds: zend extension ts For debug builds zend extension debug Check $ php v or phpinfo() ; Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 12 / 41
  • Common pitfalls extension dir directive does not take eect! Binary modules (Windows) do not work with PHP debug builds enableversioning prevents loading Other zend-extensions interfere with Xdebug Tobias Schlitt (PHP World Kongress 2009) Xdebug 2009-11-24 13 / 41
  • Conguration Huge variety of options Many shown later Overview: http://xdebug.org/docs/all_settings Most options adjustably with ini set () at runtime, except for