SlideShare a Scribd company logo
1 of 34
Download to read offline
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

What's hot

Redis As Job Cache In An Auto-Scaling Distributed Video Rendering Pipeline: P...
Redis As Job Cache In An Auto-Scaling Distributed Video Rendering Pipeline: P...Redis As Job Cache In An Auto-Scaling Distributed Video Rendering Pipeline: P...
Redis As Job Cache In An Auto-Scaling Distributed Video Rendering Pipeline: P...
Redis Labs
 
Slides Aquarium Paris 2008
Slides Aquarium Paris 2008Slides Aquarium Paris 2008
Slides Aquarium Paris 2008
julien.ponge
 

What's hot (20)

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

Viewers also liked

Cuento de navidad teatro zorrilla ocio y rutas valladolid
Cuento de navidad teatro zorrilla ocio y rutas valladolidCuento de navidad teatro zorrilla ocio y rutas valladolid
Cuento de navidad teatro zorrilla ocio y rutas valladolid
Ocio y Rutas Valladolid
 
Ecolife Recreio Eco Esfera E Mail
Ecolife Recreio   Eco Esfera   E MailEcolife Recreio   Eco Esfera   E Mail
Ecolife Recreio Eco Esfera E Mail
imoveisdorio
 
Corporate Brochure low
Corporate Brochure lowCorporate Brochure low
Corporate Brochure low
Simon notman
 
Loan training product 2014-3-8
Loan training  product 2014-3-8Loan training  product 2014-3-8
Loan training product 2014-3-8
Roslan Abdullah
 
Tenis y raquetas aconsejables
Tenis y raquetas aconsejablesTenis y raquetas aconsejables
Tenis y raquetas aconsejables
Sonia Otero
 
Proteccion Infantil en Redes Sociales
Proteccion Infantil en Redes SocialesProteccion Infantil en Redes Sociales
Proteccion Infantil en Redes Sociales
ESET Latinoamérica
 

Viewers also liked (20)

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

Similar to Debugging PHP with xDebug inside of Eclipse PDT 2.1

Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
phpbarcelona
 
Eclipse HandsOn Workshop
Eclipse HandsOn WorkshopEclipse HandsOn Workshop
Eclipse HandsOn Workshop
Bastian Feder
 
Php Inside - confoo 2011 - Derick Rethans
Php Inside -  confoo 2011 - Derick RethansPhp Inside -  confoo 2011 - Derick Rethans
Php Inside - confoo 2011 - Derick Rethans
Bachkoutou Toutou
 

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

Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
 
Xdebug
XdebugXdebug
Xdebug
 
Eclipse HandsOn Workshop
Eclipse HandsOn WorkshopEclipse HandsOn Workshop
Eclipse HandsOn Workshop
 
Xdebug - Your first, last, and best option for troubleshooting PHP code
Xdebug - Your first, last, and best option for troubleshooting PHP codeXdebug - Your first, last, and best option for troubleshooting PHP code
Xdebug - Your first, last, and best option for troubleshooting PHP code
 
Xdebug from a to x
Xdebug from a to xXdebug from a to x
Xdebug from a to x
 
Debugging and Profiling PHP Applications
Debugging and Profiling PHP ApplicationsDebugging and Profiling PHP Applications
Debugging and Profiling PHP Applications
 
(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems
 
Magento 2 Development
Magento 2 DevelopmentMagento 2 Development
Magento 2 Development
 
DDD (Debugger Driven Development)
DDD (Debugger Driven Development)DDD (Debugger Driven Development)
DDD (Debugger Driven Development)
 
Php Inside - confoo 2011 - Derick Rethans
Php Inside -  confoo 2011 - Derick RethansPhp Inside -  confoo 2011 - Derick Rethans
Php Inside - confoo 2011 - Derick Rethans
 
Diagnosing WordPress: What to do when things go wrong
Diagnosing WordPress: What to do when things go wrongDiagnosing WordPress: What to do when things go wrong
Diagnosing WordPress: What to do when things go wrong
 
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?
 
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
My journey from PHP to Node.js
My journey from PHP to Node.jsMy journey from PHP to Node.js
My journey from PHP to Node.js
 
Getting Started With Xdebug
Getting Started With XdebugGetting Started With Xdebug
Getting Started With Xdebug
 

More from Bastian Feder

More from Bastian Feder (18)

JQuery plugin development fundamentals
JQuery plugin development fundamentalsJQuery plugin development fundamentals
JQuery plugin development fundamentals
 
Why documentation osidays
Why documentation osidaysWhy documentation osidays
Why documentation osidays
 
Solid principles
Solid principlesSolid principles
Solid principles
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
Php unit the-mostunknownparts
Php unit the-mostunknownpartsPhp unit the-mostunknownparts
Php unit the-mostunknownparts
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
PhpUnit - The most unknown Parts
PhpUnit - The most unknown PartsPhpUnit - The most unknown Parts
PhpUnit - The most unknown Parts
 
Introducing TDD to your project
Introducing TDD to your projectIntroducing TDD to your project
Introducing TDD to your project
 
jQuery's Secrets
jQuery's SecretsjQuery's Secrets
jQuery's Secrets
 
The Beauty and the Beast
The Beauty and the BeastThe Beauty and the Beast
The Beauty and the Beast
 
Php unit the-mostunknownparts
Php unit the-mostunknownpartsPhp unit the-mostunknownparts
Php unit the-mostunknownparts
 
The beautyandthebeast phpbat2010
The beautyandthebeast phpbat2010The beautyandthebeast phpbat2010
The beautyandthebeast phpbat2010
 
The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09
 
Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009
 
Php Development With Eclipde PDT
Php Development With Eclipde PDTPhp Development With Eclipde PDT
Php Development With Eclipde PDT
 
Php Documentor The Beauty And The Beast
Php Documentor The Beauty And The BeastPhp Documentor The Beauty And The Beast
Php Documentor The Beauty And The Beast
 
Bubbles & Trees with jQuery
Bubbles & Trees with jQueryBubbles & Trees with jQuery
Bubbles & Trees with jQuery
 
Ajax hands on - Refactoring Google Suggest
Ajax hands on - Refactoring Google SuggestAjax hands on - Refactoring Google Suggest
Ajax hands on - Refactoring Google Suggest
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

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: lapistano@php.net
  • 32. 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
  • 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