SlideShare a Scribd company logo
Jeremy Ward
Pacific Northwest PHP Conference
September 12, 2015
Getting Started With Xdebug
• Developer at Westwerk
• Drummer for Loud Nerves
• Board game geek
• Fan of stand-up comedy
About Me
• About ‘Debugging’
• Xdebug: Overview, Features, and Benefits
• Xdebug Installation and Setup
• Application Debugging and Profiling
Today’s Topics
Getting Started With Xdebug
Our Goal
Getting Started With Xdebug
Understanding Debugging and Context
Evaluating, understanding, and
validating how your application works.
What is ‘debugging’?
var_dump()
Getting Started With Xdebug
Context Matters
Xdebug Overview
• PHP extension that provides debugging and profiling
capabilities
• Developed by Derick Rethans
• First released in May 2002
• Uses the DBGp debugging protocol
What is Xdebug?
• Debugging support
• Stack trace view
• Profiling
• Code coverage analysis
• Function logging
Features
• Step through code operations line-by-line
• View application data in memory at pre-determined
breakpoints
• Access function call stack
• Update variable values during runtime
• More detailed error messaging
Benefits
• Xdebug support exists in over a dozen IDES, including:
• PhpStorm
• Eclipse
• NetBeans
• Plain text editors too (with extensions)!
• VIM
• Sublime Text
• Notepad++
Editor Support
Setup and Configuration
Assumptions
• Pre-installed w/ some environments (MAMP, XAMPP, Vagrant)
• Install from source
• PEAR/PECL
• Detailed instructions at http://xdebug.org/docs/install
Installation
• Locate php.ini file for your PHP installation
• Unsure? Check ‘Loaded Configuration File’ using phpinfo()
• Basic settings needed to enable remote debugging:
• zend_extension=“/path/to/your/xdebug/extension”
• xdebug.remote_enable=1
• xdebug.remote_host=localhost
• xdebug.remote_port=9000
• xdebug.remote_autostart=1
Configuration
• Used primarily in virtual environments such as Vagrant
• Helps the server layer find the location of local files
• PhpStorm (and presumably other IDEs) include wizards for
setting this up
Path Mappings
Using Xdebug
• Add query parameters to the script you’re trying to load:
• Start: [url]?XDEBUG_SESSION_START=[session_name]
• Stop: [url]?XDEBUG_SESSION_STOP=[session_name]
Enabling/Disabling Xdebug
• PhpStorm’s website has a list of recommended browser extensions:

https://confluence.jetbrains.com/display/PhpStorm/Browser+Debugging
+Extensions
• Chrome:
• Xdebug Helper
• Xdebug Enabler
• Firefox:
• easy Xdebug
• The Easiest Xdebug
• Safari:
• Xdebug Toogler
Browser Extensions
• var_dump() - stylized!
• xdebug_break() - pauses the app as if a breakpoint was set
• xdebug_get_declared_vars() - returns array of elements
defined in the current scope.
• Complete list: http://xdebug.org/docs/all_functions
Useful functions
• Profiling
• KCacheGrind (Linux)
• Webgrind: https://github.com/jokkedk/webgrind
• Debugging
• MacGDBp (OSX)
• Aforementioned browser extensions
Tools
Demo
• Xdebug website: http://xdebug.org
• Xdebug and You: Why You Should Be Using a Real Debugger
(Juan Treminio) https://jtreminio.com/2012/07/xdebug-and-
you-why-you-should-be-using-a-real-debugger/
• Debugging and Profiling PHP with Xdebug (Shameer C)
http://www.sitepoint.com/debugging-and-profiling-php-
with-xdebug/
Additional Resources
Thank You!
Feedback
http://joind.in/15183
Questions?
Email: jeremy@jmichaelward.com
Twitter: @_jmichaelward
IRC: jmichaelward

More Related Content

What's hot (20)

PDF
Ansible 101 - Presentation at Ansible STL Meetup
Jeff Geerling
 
PPTX
Ansible
Vladimír Smitka
 
PPTX
Mini-Training: To cache or not to cache
Betclic Everest Group Tech Team
 
ODP
Rex - Lightning Talk yapc.eu 2013
Jan Gehring
 
PPTX
ChinaNetCloud - Zabbix Monitoring System Overview
ChinaNetCloud
 
PDF
Caching basics in PHP
Anis Ahmad
 
PDF
Server Check.in case study - Drupal and Node.js
Jeff Geerling
 
PPTX
Introduction to ansible
Dharmit Shah
 
PDF
Vault
dawnlua
 
PDF
About Caching
Weng Wei
 
PDF
NginX - good practices, tips and advanced techniques
Claudio Borges
 
PDF
OSGi Community Event 2010 - Automated Semantic Versioning for OSGi Bundles
mfrancis
 
PDF
Configuration Management - Finding the tool to fit your needs
SaltStack
 
PDF
Introducing DeploYii 0.5
Giovanni Derks
 
PDF
Seguranca em APP Rails
Daniel Lopes
 
ODP
From Test to Live with Rex
Jan Gehring
 
KEY
Seedhack MongoDB 2011
Rainforest QA
 
PDF
Javascript Test Automation Workshop (21.08.2014)
Deutsche Post
 
PPTX
Ansible in CI
Dharmit Shah
 
PDF
Introduction to selenium_grid_workshop
seleniumconf
 
Ansible 101 - Presentation at Ansible STL Meetup
Jeff Geerling
 
Mini-Training: To cache or not to cache
Betclic Everest Group Tech Team
 
Rex - Lightning Talk yapc.eu 2013
Jan Gehring
 
ChinaNetCloud - Zabbix Monitoring System Overview
ChinaNetCloud
 
Caching basics in PHP
Anis Ahmad
 
Server Check.in case study - Drupal and Node.js
Jeff Geerling
 
Introduction to ansible
Dharmit Shah
 
Vault
dawnlua
 
About Caching
Weng Wei
 
NginX - good practices, tips and advanced techniques
Claudio Borges
 
OSGi Community Event 2010 - Automated Semantic Versioning for OSGi Bundles
mfrancis
 
Configuration Management - Finding the tool to fit your needs
SaltStack
 
Introducing DeploYii 0.5
Giovanni Derks
 
Seguranca em APP Rails
Daniel Lopes
 
From Test to Live with Rex
Jan Gehring
 
Seedhack MongoDB 2011
Rainforest QA
 
Javascript Test Automation Workshop (21.08.2014)
Deutsche Post
 
Ansible in CI
Dharmit Shah
 
Introduction to selenium_grid_workshop
seleniumconf
 

Viewers also liked (14)

PDF
NYHTbrochurePRINT
Jennifer Draper
 
PDF
Ejercicio 17 pag 87
laurads12
 
DOCX
Real Estate Resume
Leigh Disney
 
PPTX
Julkisuus osana asiantuntijatyötä 15.1.2014
Eläketurvakeskus
 
PDF
Debugging WooCommerce - WooConf Talk
Andrew Wikel
 
PDF
ahsan habib paper
ahsan habib
 
DOCX
Actividad 3
Elena Lafuente Plaza
 
PDF
Rapport_SISTA_VERSION
Kika Diestre
 
PDF
La colaboración público-privada en los entes mixtos locales de gestión y pro...
David Vicent
 
PDF
UNWTO Global Report on Meetings Industry 2013
David Vicent
 
PDF
Inversión en Viajes y Turismo en las Américas. Estudio WTTC 2014
David Vicent
 
PDF
Citizen Evaluation of Property Development
glennweiss
 
PDF
A new approach to b2b marketing in professional services
Rick VARGAS
 
ODP
ανακυκλωση
Ειρήνη
 
NYHTbrochurePRINT
Jennifer Draper
 
Ejercicio 17 pag 87
laurads12
 
Real Estate Resume
Leigh Disney
 
Julkisuus osana asiantuntijatyötä 15.1.2014
Eläketurvakeskus
 
Debugging WooCommerce - WooConf Talk
Andrew Wikel
 
ahsan habib paper
ahsan habib
 
Rapport_SISTA_VERSION
Kika Diestre
 
La colaboración público-privada en los entes mixtos locales de gestión y pro...
David Vicent
 
UNWTO Global Report on Meetings Industry 2013
David Vicent
 
Inversión en Viajes y Turismo en las Américas. Estudio WTTC 2014
David Vicent
 
Citizen Evaluation of Property Development
glennweiss
 
A new approach to b2b marketing in professional services
Rick VARGAS
 
ανακυκλωση
Ειρήνη
 
Ad

Similar to Getting Started With Xdebug (20)

ODP
Xdebug for Beginners
Sean Prunka
 
PDF
Debugging PHP with xDebug inside of Eclipse PDT 2.1
Bastian Feder
 
PPTX
Xdebug
Bryce Embry
 
PPTX
Xdebug - Your first, last, and best option for troubleshooting PHP code
Adam Englander
 
PDF
Xdebug from a to x
Gennady Feldman
 
PDF
Debugging PHP With Xdebug
Mark Niebergall
 
PDF
Debugging PHP with Xdebug - PHPUK 2018
Mark Niebergall
 
PPTX
DDD (Debugger Driven Development)
Carlos Granados
 
PDF
X-Debug in Php Storm
KLabCyscorpions-TechBlog
 
PDF
Introduction to Xdebug
Abid Malik
 
PDF
Debugging and Profiling PHP Applications
Logan Lindquist
 
PDF
Debugging WordPress with xDebug
WordCamp Sydney
 
PDF
Xdebug
Tobias Schlitt
 
PDF
Debugging Drupal with Xdebug
Frank Carey
 
PDF
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
phpbarcelona
 
PPTX
Drupal Development w/ PhpStorm and Xdebug
Chris Haynes
 
PDF
Xdebug
Tobias Schlitt
 
PPT
PHP: Debugger, Profiler and more
Võ Duy Tuấn
 
PDF
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Francisco José Seva Mora
 
PPT
Php Debugger
guest8cd374
 
Xdebug for Beginners
Sean Prunka
 
Debugging PHP with xDebug inside of Eclipse PDT 2.1
Bastian Feder
 
Xdebug
Bryce Embry
 
Xdebug - Your first, last, and best option for troubleshooting PHP code
Adam Englander
 
Xdebug from a to x
Gennady Feldman
 
Debugging PHP With Xdebug
Mark Niebergall
 
Debugging PHP with Xdebug - PHPUK 2018
Mark Niebergall
 
DDD (Debugger Driven Development)
Carlos Granados
 
X-Debug in Php Storm
KLabCyscorpions-TechBlog
 
Introduction to Xdebug
Abid Malik
 
Debugging and Profiling PHP Applications
Logan Lindquist
 
Debugging WordPress with xDebug
WordCamp Sydney
 
Debugging Drupal with Xdebug
Frank Carey
 
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
phpbarcelona
 
Drupal Development w/ PhpStorm and Xdebug
Chris Haynes
 
PHP: Debugger, Profiler and more
Võ Duy Tuấn
 
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Francisco José Seva Mora
 
Php Debugger
guest8cd374
 
Ad

Recently uploaded (20)

PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
July Patch Tuesday
Ivanti
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 

Getting Started With Xdebug

  • 1. Jeremy Ward Pacific Northwest PHP Conference September 12, 2015 Getting Started With Xdebug
  • 2. • Developer at Westwerk • Drummer for Loud Nerves • Board game geek • Fan of stand-up comedy About Me
  • 3. • About ‘Debugging’ • Xdebug: Overview, Features, and Benefits • Xdebug Installation and Setup • Application Debugging and Profiling Today’s Topics
  • 8. Evaluating, understanding, and validating how your application works. What is ‘debugging’?
  • 13. • PHP extension that provides debugging and profiling capabilities • Developed by Derick Rethans • First released in May 2002 • Uses the DBGp debugging protocol What is Xdebug?
  • 14. • Debugging support • Stack trace view • Profiling • Code coverage analysis • Function logging Features
  • 15. • Step through code operations line-by-line • View application data in memory at pre-determined breakpoints • Access function call stack • Update variable values during runtime • More detailed error messaging Benefits
  • 16. • Xdebug support exists in over a dozen IDES, including: • PhpStorm • Eclipse • NetBeans • Plain text editors too (with extensions)! • VIM • Sublime Text • Notepad++ Editor Support
  • 19. • Pre-installed w/ some environments (MAMP, XAMPP, Vagrant) • Install from source • PEAR/PECL • Detailed instructions at http://xdebug.org/docs/install Installation
  • 20. • Locate php.ini file for your PHP installation • Unsure? Check ‘Loaded Configuration File’ using phpinfo() • Basic settings needed to enable remote debugging: • zend_extension=“/path/to/your/xdebug/extension” • xdebug.remote_enable=1 • xdebug.remote_host=localhost • xdebug.remote_port=9000 • xdebug.remote_autostart=1 Configuration
  • 21. • Used primarily in virtual environments such as Vagrant • Helps the server layer find the location of local files • PhpStorm (and presumably other IDEs) include wizards for setting this up Path Mappings
  • 23. • Add query parameters to the script you’re trying to load: • Start: [url]?XDEBUG_SESSION_START=[session_name] • Stop: [url]?XDEBUG_SESSION_STOP=[session_name] Enabling/Disabling Xdebug
  • 24. • PhpStorm’s website has a list of recommended browser extensions:
 https://confluence.jetbrains.com/display/PhpStorm/Browser+Debugging +Extensions • Chrome: • Xdebug Helper • Xdebug Enabler • Firefox: • easy Xdebug • The Easiest Xdebug • Safari: • Xdebug Toogler Browser Extensions
  • 25. • var_dump() - stylized! • xdebug_break() - pauses the app as if a breakpoint was set • xdebug_get_declared_vars() - returns array of elements defined in the current scope. • Complete list: http://xdebug.org/docs/all_functions Useful functions
  • 26. • Profiling • KCacheGrind (Linux) • Webgrind: https://github.com/jokkedk/webgrind • Debugging • MacGDBp (OSX) • Aforementioned browser extensions Tools
  • 27. Demo
  • 28. • Xdebug website: http://xdebug.org • Xdebug and You: Why You Should Be Using a Real Debugger (Juan Treminio) https://jtreminio.com/2012/07/xdebug-and- you-why-you-should-be-using-a-real-debugger/ • Debugging and Profiling PHP with Xdebug (Shameer C) http://www.sitepoint.com/debugging-and-profiling-php- with-xdebug/ Additional Resources