SlideShare a Scribd company logo
Debugging PHP
                             with
                            Xdebug
                           Inside of
                       Eclipse PDT 2.0


Bastian Feder                             IPC 2009
papaya Software GmbH                     18.11.2009
Me, myself & I
           Application developer
           PHP since 2001
           @papaya since
            01.2008
           OpenSource addict
               ▹   fluentDom.org
               ▹   CaricaCacheGrind
Who are you?
Derrick Rethans



„ Xdebug   ̶

 PHP developer's Swiss-Army Knife   “
What is this xDebug ev'ryone's talking about?
   Debugging for PHP by Derick Rethans
    (http://www.xdebug.org)
   Provides
        ▹   profiling, tracing, code coverage, …
        ▹   PHP error reporting enhancements
   Cross platform
What's up for this talk?
   Installation
   Configuration
   Techniques
   Eclipse PDT
   Troubleshooting
Obtaining Xdebug - Linux

       #> sudo apt-get install php5-xdebug ↵

       #> php -v ↵

      PHP 5.2.-3ubuntu4.2 with Suhoshin-Patch 0.9.6.2 (cli)
      Copyright © 1997-2008 The PHP Group
      Zend Engine v2.2.0, Copyright © 2002-2008 Zend Technologies
        with Xdebug v2.0.5, Copyright © 2002-2008, by Derick Rethans


   Easiest way on Linux systems
   Basic configuration
Obtaining Xdebug - PECL

       #> sudo pecl install xdebug ↵


   Still configurations to be done
       ▹   Add:
             zend_extension=“/usr/local/php/modules/xdebug.so

         to php.ini
   Ignore notes about to add
    „extension=xdebug.so“ → causes problems
Obtaining Xdebug – precompiled Modules




   ActiveState
       ▹   Komodo IDE Xdebug binaries
            (http://downloads.activestate.com/Komodo/releases/5.2.2/remotedebugging)
Configuration
   Add to php.ini

[XDebug]
;; Only Zend OR (!) XDebug
zend_extension="/usr/local/php/modules/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1 ;if debugging on remote server, put client IP here
xdebug.remote_port=9000
xdebug.remote_handler=dbgp

;; profiler
xdebug.profiler_enable=Off
xdebug.profiler_enable_trigger=On
xdebug.profiler_output_dir=/data_lokal/temp/xdebug/profiling
Configuration (II)
     .htaccess – file settings

#-------------------------------#
# xDebug section            #
#-------------------------------#

php_value xdebug.remote_enable 1
php_value xdebug.remote_handler bdgp
                                dbgp
php_value xdebug.remote_host 127.0.0.1 ;if debugging on remote server, put client IP here
php_value xdebug.allowed_clients <client IP address>
php_value xdebug.remote_port 9000

# profiler
php_value xdebug.profiler_enable_trigger 1
php_value xdebug.profiler_enable 0
php_value xdebug.profiler_output_dir "/data_lokal/temp/xdebug/profiling"
Debugging techniques
   Local debugging
Debugging techniques (II)
   Remote debugging
Debugging techniques (III)
   Multi-User Debugging
       ▹   Only possible using Remote Debugging
       ▹   DBGp Proxy necessary
Eclipse PDT
Eclipse PDT
   Debug Perspective
   Debug Views
   Support for
       ▹   Breakpoints
       ▹   Conditional Breakpoints
       ▹   Live view / edit of variable content
       ▹   All debugging techniques
Debugging perspective
Preferences – Basic setup
General settings
   Debug Port
   Multisession
   DBGp Proxy settings
Preferences – Basic setup
Preferences – PHP servers
   Remote debugging
   Mapping between IDE and Xdebug
Configuration for remote debugging
Start a remote debugging session
Start a local debugging
Configure „autostart“ options
   Accept JIT
       ▹  Localhost
        ▹ any
        ▹ Prompt
   Disable Multisession
    currently a Bug in PDT
Debug CLI scripts

       #> export XDEBUG_CONFIG=“idekey=ECLIPSE_DBGP“↵

       #> php myScript.php ↵

       #> export XDEBUG_CONFIG=““ ↵




   Preconditions
        ▹JIT configured
       ▹ Breakpoint set or 'Break at first line' active
   Debug cronjobs, PHPUnit tests, etc.
Debugging made easy!
   Firefox Add-on
    „Xdebug Helper“
DEMO
Troubleshooting
   Monitor TCP/IP
       ▹   Withershark / ethereal
       ▹   TCP/IP Monitor
TCP/IP Monitor (remote debugging only)
Questions?




             Further questions? Ask me at:

             lapistano@php.net
Contact'n Slides
   Slides
       ▹   SlideShare: http://slideshare.com/lapistano
   Contact
       ▹   Blog: http://bastian-feder.de
       ▹   Email: php@bastian-feder.de
   Rate the talk @ http://joind.in/talk/view/1066
References
   xDebug
    (http://www.xdebug.org)

           ▹   Komodo precompilations
                  (http://downloads.activestate.com/Komodo/releases/5.2.2/remotedebugging)

           ▹   DBGp Proxy
                  (http://derickrethans.nl/debugging_with_multiple_users.php)

   Eclipse PDT
    (http://www.eclipse.org/pdt)

   Xdebug-Helper
    (https://addons.mozilla.org/en-US/firefox/addon/3960 )
License
   This set of slides and the source code included
    in the download package is licensed under the

        Creative Commons Attribution-
     Noncommercial-Share Alike 2.0 Generic
                   License


      http://creativecommons.org/licenses/by-nc-sa/2.0/deed.en

More Related Content

PDF
Debugging Drupal with Xdebug
PDF
OlinData Puppet Presentation for MOSC 2012
PDF
Puppet evolutions
PDF
digitalSTROM Developer Day 2011: Wie Heimelektronik und digitalSTROM zusammen...
PDF
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
ODP
Redis as Job Cache in an Auto-Scaling Video Rendering Pipeline
PDF
Statyczna analiza kodu PHP
PPTX
20151229 wnmp & phalcon micro app - part I
Debugging Drupal with Xdebug
OlinData Puppet Presentation for MOSC 2012
Puppet evolutions
digitalSTROM Developer Day 2011: Wie Heimelektronik und digitalSTROM zusammen...
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Redis as Job Cache in an Auto-Scaling Video Rendering Pipeline
Statyczna analiza kodu PHP
20151229 wnmp & phalcon micro app - part I

What's hot (20)

PDF
Redis As Job Cache In An Auto-Scaling Distributed Video Rendering Pipeline: P...
PDF
node.js - Eventful JavaScript on the Server
PDF
Node.js Explained
PDF
Docker1.12イングレスロードバランサ
PDF
Chef - industrialize and automate your infrastructure
PDF
Hyperledger composer
PDF
Test Driven Development with Puppet - PuppetConf 2014
PDF
Docker 初探,實驗室中的運貨鯨
PDF
Tensorflow in Docker
PDF
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
PDF
Drone CI/CD 自動化測試及部署
PPT
Nodejs Event Driven Concurrency for Web Applications
PDF
Docker workshop 0507 Taichung
PDF
Golang Project Layout and Practice
PDF
Configuring Django projects for multiple environments
KEY
Scaling Django
PDF
Betabeers Android as a Digital Signage platform
PDF
Slides Aquarium Paris 2008
PDF
Docker remote-api
PDF
NodeJS: an Introduction
Redis As Job Cache In An Auto-Scaling Distributed Video Rendering Pipeline: P...
node.js - Eventful JavaScript on the Server
Node.js Explained
Docker1.12イングレスロードバランサ
Chef - industrialize and automate your infrastructure
Hyperledger composer
Test Driven Development with Puppet - PuppetConf 2014
Docker 初探,實驗室中的運貨鯨
Tensorflow in Docker
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Drone CI/CD 自動化測試及部署
Nodejs Event Driven Concurrency for Web Applications
Docker workshop 0507 Taichung
Golang Project Layout and Practice
Configuring Django projects for multiple environments
Scaling Django
Betabeers Android as a Digital Signage platform
Slides Aquarium Paris 2008
Docker remote-api
NodeJS: an Introduction
Ad

Viewers also liked (20)

PPT
El Proyecto Matriz #102.¿ILEGALES?: EN BUSCA DE LIBERTAD HUMANA
PDF
Cuento de navidad teatro zorrilla ocio y rutas valladolid
PDF
WFS AZ - Today’s Gadgets & Emerging Technology Innovations 10/21/15
PDF
SISO LSA AND OMG DDS
DOCX
Noticias nxt
PPS
Ecolife Recreio Eco Esfera E Mail
PDF
OpenRISC processor
PDF
Corporate Brochure low
PDF
Diari del 23 de setembre de 2013
PPT
Loan training product 2014-3-8
PPTX
Tenis y raquetas aconsejables
PDF
Revista Mundo Contact Agosto 2011
PDF
Nascholing problematisch ziekteverzuim voor casemanagers
PDF
NC-2011-05-01-1
PDF
Proyecto de Inversión en España - ES/DE
PDF
Shopaholictiestheknot
PDF
Diplomarbeit Vitus LM
PDF
Top10 Biggest Security Threats
PDF
Metaforer i GUI kan kastes! (Eller "flyttes til papirkurves")
PDF
Proteccion Infantil en Redes Sociales
El Proyecto Matriz #102.¿ILEGALES?: EN BUSCA DE LIBERTAD HUMANA
Cuento de navidad teatro zorrilla ocio y rutas valladolid
WFS AZ - Today’s Gadgets & Emerging Technology Innovations 10/21/15
SISO LSA AND OMG DDS
Noticias nxt
Ecolife Recreio Eco Esfera E Mail
OpenRISC processor
Corporate Brochure low
Diari del 23 de setembre de 2013
Loan training product 2014-3-8
Tenis y raquetas aconsejables
Revista Mundo Contact Agosto 2011
Nascholing problematisch ziekteverzuim voor casemanagers
NC-2011-05-01-1
Proyecto de Inversión en España - ES/DE
Shopaholictiestheknot
Diplomarbeit Vitus LM
Top10 Biggest Security Threats
Metaforer i GUI kan kastes! (Eller "flyttes til papirkurves")
Proteccion Infantil en Redes Sociales
Ad

Similar to Debugging PHP with xDebug inside of Eclipse PDT 2.1 (20)

PDF
Xdebug from a to x
PDF
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
PPTX
Xdebug - Your first, last, and best option for troubleshooting PHP code
PDF
Debugging PHP with Xdebug - PHPUK 2018
PDF
Getting Started With Xdebug
PDF
Debugging PHP With Xdebug
ODP
Xdebug for Beginners
PDF
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
PDF
PPTX
Xdebug
PPTX
XDebug For php debugging
PDF
Introduction to Xdebug
PPTX
DDD (Debugger Driven Development)
PDF
PPTX
Debugging with Zend Studio for Eclipse
PDF
Eclipse HandsOn Workshop
PDF
Debugging WordPress with xDebug
PPTX
Drupal Development w/ PhpStorm and Xdebug
PPT
PHP: Debugger, Profiler and more
PDF
Eclipse Pdt2.0 26.05.2009
Xdebug from a to x
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Your first, last, and best option for troubleshooting PHP code
Debugging PHP with Xdebug - PHPUK 2018
Getting Started With Xdebug
Debugging PHP With Xdebug
Xdebug for Beginners
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Xdebug
XDebug For php debugging
Introduction to Xdebug
DDD (Debugger Driven Development)
Debugging with Zend Studio for Eclipse
Eclipse HandsOn Workshop
Debugging WordPress with xDebug
Drupal Development w/ PhpStorm and Xdebug
PHP: Debugger, Profiler and more
Eclipse Pdt2.0 26.05.2009

More from Bastian Feder (17)

PDF
JQuery plugin development fundamentals
PDF
Why documentation osidays
PDF
Solid principles
PDF
jQuery secrets
PDF
Php unit the-mostunknownparts
PDF
jQuery secrets
PDF
PhpUnit - The most unknown Parts
PDF
Introducing TDD to your project
PDF
jQuery's Secrets
PDF
The Beauty and the Beast
PDF
Php unit the-mostunknownparts
PDF
The beautyandthebeast phpbat2010
PDF
The Beauty And The Beast Php N W09
PDF
Php Development With Eclipde PDT
PDF
Php Documentor The Beauty And The Beast
PDF
Bubbles & Trees with jQuery
ODP
Ajax hands on - Refactoring Google Suggest
JQuery plugin development fundamentals
Why documentation osidays
Solid principles
jQuery secrets
Php unit the-mostunknownparts
jQuery secrets
PhpUnit - The most unknown Parts
Introducing TDD to your project
jQuery's Secrets
The Beauty and the Beast
Php unit the-mostunknownparts
The beautyandthebeast phpbat2010
The Beauty And The Beast Php N W09
Php Development With Eclipde PDT
Php Documentor The Beauty And The Beast
Bubbles & Trees with jQuery
Ajax hands on - Refactoring Google Suggest

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
cuic standard and advanced reporting.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Cloud computing and distributed systems.
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPT
Teaching material agriculture food technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
cuic standard and advanced reporting.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Spectroscopy.pptx food analysis technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Cloud computing and distributed systems.
madgavkar20181017ppt McKinsey Presentation.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Chapter 3 Spatial Domain Image Processing.pdf
Empathic Computing: Creating Shared Understanding
Per capita expenditure prediction using model stacking based on satellite ima...
Teaching material agriculture food technology
Network Security Unit 5.pdf for BCA BBA.
“AI and Expert System Decision Support & Business Intelligence Systems”
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Machine learning based COVID-19 study performance prediction
GamePlan Trading System Review: Professional Trader's Honest Take

Debugging PHP with xDebug inside of Eclipse PDT 2.1

  • 1. Debugging PHP with Xdebug Inside of Eclipse PDT 2.0 Bastian Feder IPC 2009 papaya Software GmbH 18.11.2009
  • 2. Me, myself & I  Application developer  PHP since 2001  @papaya since 01.2008  OpenSource addict ▹ fluentDom.org ▹ CaricaCacheGrind
  • 4. Derrick Rethans „ Xdebug ̶ PHP developer's Swiss-Army Knife “
  • 5. What is this xDebug ev'ryone's talking about?  Debugging for PHP by Derick Rethans (http://www.xdebug.org)  Provides ▹ profiling, tracing, code coverage, … ▹ PHP error reporting enhancements  Cross platform
  • 6. What's up for this talk?  Installation  Configuration  Techniques  Eclipse PDT  Troubleshooting
  • 7. Obtaining Xdebug - Linux #> sudo apt-get install php5-xdebug ↵ #> php -v ↵ PHP 5.2.-3ubuntu4.2 with Suhoshin-Patch 0.9.6.2 (cli) Copyright © 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright © 2002-2008 Zend Technologies with Xdebug v2.0.5, Copyright © 2002-2008, by Derick Rethans  Easiest way on Linux systems  Basic configuration
  • 8. Obtaining Xdebug - PECL #> sudo pecl install xdebug ↵  Still configurations to be done ▹ Add: zend_extension=“/usr/local/php/modules/xdebug.so to php.ini  Ignore notes about to add „extension=xdebug.so“ → causes problems
  • 9. Obtaining Xdebug – precompiled Modules  ActiveState ▹ Komodo IDE Xdebug binaries (http://downloads.activestate.com/Komodo/releases/5.2.2/remotedebugging)
  • 10. Configuration  Add to php.ini [XDebug] ;; Only Zend OR (!) XDebug zend_extension="/usr/local/php/modules/xdebug.so" xdebug.remote_enable=true xdebug.remote_host=127.0.0.1 ;if debugging on remote server, put client IP here xdebug.remote_port=9000 xdebug.remote_handler=dbgp ;; profiler xdebug.profiler_enable=Off xdebug.profiler_enable_trigger=On xdebug.profiler_output_dir=/data_lokal/temp/xdebug/profiling
  • 11. Configuration (II)  .htaccess – file settings #-------------------------------# # xDebug section # #-------------------------------# php_value xdebug.remote_enable 1 php_value xdebug.remote_handler bdgp dbgp php_value xdebug.remote_host 127.0.0.1 ;if debugging on remote server, put client IP here php_value xdebug.allowed_clients <client IP address> php_value xdebug.remote_port 9000 # profiler php_value xdebug.profiler_enable_trigger 1 php_value xdebug.profiler_enable 0 php_value xdebug.profiler_output_dir "/data_lokal/temp/xdebug/profiling"
  • 12. Debugging techniques  Local debugging
  • 13. Debugging techniques (II)  Remote debugging
  • 14. Debugging techniques (III)  Multi-User Debugging ▹ Only possible using Remote Debugging ▹ DBGp Proxy necessary
  • 16. Eclipse PDT  Debug Perspective  Debug Views  Support for ▹ Breakpoints ▹ Conditional Breakpoints ▹ Live view / edit of variable content ▹ All debugging techniques
  • 19. General settings  Debug Port  Multisession  DBGp Proxy settings
  • 21. Preferences – PHP servers  Remote debugging  Mapping between IDE and Xdebug
  • 23. Start a remote debugging session
  • 24. Start a local debugging
  • 25. Configure „autostart“ options  Accept JIT ▹ Localhost ▹ any ▹ Prompt  Disable Multisession currently a Bug in PDT
  • 26. Debug CLI scripts #> export XDEBUG_CONFIG=“idekey=ECLIPSE_DBGP“↵ #> php myScript.php ↵ #> export XDEBUG_CONFIG=““ ↵  Preconditions ▹JIT configured ▹ Breakpoint set or 'Break at first line' active  Debug cronjobs, PHPUnit tests, etc.
  • 27. Debugging made easy!  Firefox Add-on „Xdebug Helper“
  • 28. DEMO
  • 29. Troubleshooting  Monitor TCP/IP ▹ Withershark / ethereal ▹ TCP/IP Monitor
  • 30. TCP/IP Monitor (remote debugging only)
  • 31. Questions? Further questions? Ask me at: [email protected]
  • 32. Contact'n Slides  Slides ▹ SlideShare: http://slideshare.com/lapistano  Contact ▹ Blog: http://bastian-feder.de ▹ Email: [email protected]  Rate the talk @ http://joind.in/talk/view/1066
  • 33. References  xDebug (http://www.xdebug.org) ▹ Komodo precompilations (http://downloads.activestate.com/Komodo/releases/5.2.2/remotedebugging) ▹ DBGp Proxy (http://derickrethans.nl/debugging_with_multiple_users.php)  Eclipse PDT (http://www.eclipse.org/pdt)  Xdebug-Helper (https://addons.mozilla.org/en-US/firefox/addon/3960 )
  • 34. License  This set of slides and the source code included in the download package is licensed under the Creative Commons Attribution- Noncommercial-Share Alike 2.0 Generic License http://creativecommons.org/licenses/by-nc-sa/2.0/deed.en