SlideShare a Scribd company logo
heliocore.com
Frank Carey
CEO - Co-founder
Debugging Drupal with Xdebug
Heliocore
heliocore.com
Frank Carey
CEO - Co-founder
Follow me @frankcarey
heliocore.com
Frank Carey
CEO - Co-founder
What is XDebug?
● PHP debugger extension available since 2002
● Created by Derick Rethans
● Written in C and Open Source
● Uses DeBuGger protocol (DBGp)
● Starts when your php process starts, and tries
to communicate with port 9000 (default)
● Provides all kinds of goodies we’ll talk about!
XDEBUG: Hey, anyone listening on ip address
127.0.0.1 and port 9000? If not, I’m just going to
continue..
IDE: Hey XDEBUG, I’m here so hold on.. I’d like
you to stop at these breakpoints if you get to them.
XDEBUG: OK, I’ll reply back if I hit one of those
breakpoints.
XDEBUG: Hey, IDE I just hit breakpoint 2 and
stopped.. What do you want me to do now? ...
How XDebug communicates
1) Check if already installed (phpinfo())
2) PECL
pecl install xdebug
(OR) HOMEBREW
brew install php56-xdebug
3) Add xdebug module and settings to php.ini*
*The php.ini you have for cli (drush) is often different than
your Apache php.ini
Installing Xdebug
You need to know the right ip address to connect to!
Are you running php local or remotely?
Running Local (127.0.0.1) Running remote (192.168.X.1)
XAMP/WAMP etc
Acquia Dev Desktop
OSX native php
Homebrew php
DrupalVM
Vagrant
VirtualBox
Docker
Remote Server
Check phpinfo() or php -i | grep xdebug
zend_extension=/.../xdebug.so
xdebug.remote_enable=On
xdebug.remote_host=192.168.99.1
xdebug.remote_autostart=1
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
xdebug.max_nesting_level=256
Php.ini Xdebug settings
heliocore.com
Frank Carey
CEO - Co-founder
Debugging
without Xdebug
Debugging Without XDebug
● var_dump(), print_r(), echo()
● drupal_set_message()
● Devel Module:
○ dpm/dsm()
○ drupal_debug()
Example dpm() output using Devel module.
● Shooting in the dark / trial and error
● Pollutes screen
● Memory intensive
● Requires altering your code (and remembering
to clean it up)
● dpm() not reliable
● Very limited functionality
○ Can’t pause execution
○ Read only
○ One thread only
Limitations of the Devel approach
● Requires an IDE (that has good support)
● Requires a PHP extension to be installed
● Requires ini settings
● Adds overhead to PHP when installed:
○ Drupal
○ Composer
Limitations of Debugging with XDebug
heliocore.com
Frank Carey
CEO - Co-founder
Debugging
WITH Xdebug
● Real-time debugging
○ Stepping through code
○ Inspecting variables
○ Call Stack
● Advanced Breakpoints
● Watches
● Changing Values on the fly!
Features we’ll Demonstrate
heliocore.com
Frank Carey
CEO - Co-founder
Setting up
PHPStorm
(DEMO)
heliocore.com
Frank Carey
CEO - Co-founder
Watches
(DEMO)
heliocore.com
Frank Carey
CEO - Co-founder
Debugging
Basics
(DEMO)
heliocore.com
Frank Carey
CEO - Co-founder
Advanced
Breakpoints
(DEMO)
THANKS!
Follow me @frankcarey
Check out Ahoy 2.x at: bit.ly/ahoycli

More Related Content

PDF
Essential debugging php debugging techniques, tips & tricks
PDF
Debugging PHP with xDebug inside of Eclipse PDT 2.1
PDF
10 Groovy Little JavaScript Tips
PDF
vimshell made other shells legacy
PPTX
PHP and node.js Together
PDF
Enjoy Writing Modern Desktop Application in JavaScript
PDF
deoplete: The dark powered auto completion plugin for neovim
PDF
Inner Symfony’s Daemons
Essential debugging php debugging techniques, tips & tricks
Debugging PHP with xDebug inside of Eclipse PDT 2.1
10 Groovy Little JavaScript Tips
vimshell made other shells legacy
PHP and node.js Together
Enjoy Writing Modern Desktop Application in JavaScript
deoplete: The dark powered auto completion plugin for neovim
Inner Symfony’s Daemons

What's hot (20)

PDF
Even better debugging; Equipped yourself with powerful tools.
PDF
Lowcode: Redoing NativeBoost Portably
ODP
Virtual domains
PPTX
Native client
PDF
Xdebug from a to x
PPTX
Introduce native client
PDF
Voicecon - Mashups with Tropo.com
PPTX
Drupal hhvm benchmark
PPTX
Automation testing with Drupal 8
PDF
Open source applications softwares
PPT
first blog entry
PDF
Headless approach and Acquia - Case study - Chris Ozog
ODP
Neosnippet.vim + Deoppet.nvim in Vim conf 2017
PDF
Debugging With Symfony
PDF
Docker jako prostředí pro automatizaci testů
ODP
Native client (Евгений Эльцин)
PDF
Xdebug as a Drupal debugging tool
PDF
Introduction of Pharo 5.0
PPT
Krazykoder loos in java
PPTX
Kickstart Kotlin
Even better debugging; Equipped yourself with powerful tools.
Lowcode: Redoing NativeBoost Portably
Virtual domains
Native client
Xdebug from a to x
Introduce native client
Voicecon - Mashups with Tropo.com
Drupal hhvm benchmark
Automation testing with Drupal 8
Open source applications softwares
first blog entry
Headless approach and Acquia - Case study - Chris Ozog
Neosnippet.vim + Deoppet.nvim in Vim conf 2017
Debugging With Symfony
Docker jako prostředí pro automatizaci testů
Native client (Евгений Эльцин)
Xdebug as a Drupal debugging tool
Introduction of Pharo 5.0
Krazykoder loos in java
Kickstart Kotlin
Ad

Viewers also liked (19)

PPT
China or Not?
PPTX
Big Data and Hadoop Training in Bangalore by myTectra
DOC
Partea 2
PPTX
Amiel Dahn Sarmiento - Project in Arts
PPT
STOP AEBE Personal Protective Equipment
PPTX
bayi lahir tidak menangis heni
PDF
Image Marketing Infographic And Benefits
PDF
Beume out 16 pdf
PPTX
Collages
PPT
School presentation
PDF
Preaching Beyond the (Green) Choir
PPTX
BollyArts Bollywood Dancers & Team - The Best Of Bollywood In New York
PDF
Kanchi Periva Forum - Ebook # 10 - Gaya Sraaddha Special Edition
PPTX
Question 3
PPTX
Lucia conde
PDF
A Generic Mapping-based Query Translation from SPARQL to Various Target Datab...
PDF
P mysql training in bangalore
PPTX
Ctr (choose the right)
PPTX
Qlikview Training in Bangalore by myTectra
China or Not?
Big Data and Hadoop Training in Bangalore by myTectra
Partea 2
Amiel Dahn Sarmiento - Project in Arts
STOP AEBE Personal Protective Equipment
bayi lahir tidak menangis heni
Image Marketing Infographic And Benefits
Beume out 16 pdf
Collages
School presentation
Preaching Beyond the (Green) Choir
BollyArts Bollywood Dancers & Team - The Best Of Bollywood In New York
Kanchi Periva Forum - Ebook # 10 - Gaya Sraaddha Special Edition
Question 3
Lucia conde
A Generic Mapping-based Query Translation from SPARQL to Various Target Datab...
P mysql training in bangalore
Ctr (choose the right)
Qlikview Training in Bangalore by myTectra
Ad

Similar to Debugging Drupal with Xdebug (20)

PDF
Debugging and Profiling PHP Applications
PDF
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
PPTX
DDD (Debugger Driven Development)
PDF
Introduction to Xdebug
PDF
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
ODP
Using PHP IDEs with Drupal (DrupalDevDays Szeged 2014)
PPTX
Xdebug - Your first, last, and best option for troubleshooting PHP code
PDF
Modernize Your Drupal Development
ODP
Xdebug for Beginners
PPTX
Xdebug
ODP
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
PDF
Best Practices in PHP Application Deployment
PDF
Debugging WordPress with xDebug
PDF
Using Delphi as a no code development environment
PDF
Laravel level 0 (introduction)
PDF
Swoole Meetup AFUP¨Montpellier 27/01/2021
PDF
Debugging Drupal - How to Debug your Drupal Application
PDF
EKON 25 Python4Delphi_mX4
PDF
X-Debug in Php Storm
PDF
PHP, Under The Hood - DPC
Debugging and Profiling PHP Applications
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
DDD (Debugger Driven Development)
Introduction to Xdebug
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Using PHP IDEs with Drupal (DrupalDevDays Szeged 2014)
Xdebug - Your first, last, and best option for troubleshooting PHP code
Modernize Your Drupal Development
Xdebug for Beginners
Xdebug
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
Best Practices in PHP Application Deployment
Debugging WordPress with xDebug
Using Delphi as a no code development environment
Laravel level 0 (introduction)
Swoole Meetup AFUP¨Montpellier 27/01/2021
Debugging Drupal - How to Debug your Drupal Application
EKON 25 Python4Delphi_mX4
X-Debug in Php Storm
PHP, Under The Hood - DPC

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Encapsulation theory and applications.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
KodekX | Application Modernization Development
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Approach and Philosophy of On baking technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Monthly Chronicles - July 2025
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectral efficient network and resource selection model in 5G networks
MYSQL Presentation for SQL database connectivity
Encapsulation theory and applications.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
The AUB Centre for AI in Media Proposal.docx
Review of recent advances in non-invasive hemoglobin estimation
KodekX | Application Modernization Development
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Chapter 3 Spatial Domain Image Processing.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Network Security Unit 5.pdf for BCA BBA.
Understanding_Digital_Forensics_Presentation.pptx
Big Data Technologies - Introduction.pptx
Approach and Philosophy of On baking technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

Debugging Drupal with Xdebug

  • 1. heliocore.com Frank Carey CEO - Co-founder Debugging Drupal with Xdebug Heliocore heliocore.com Frank Carey CEO - Co-founder Follow me @frankcarey
  • 3. What is XDebug? ● PHP debugger extension available since 2002 ● Created by Derick Rethans ● Written in C and Open Source ● Uses DeBuGger protocol (DBGp) ● Starts when your php process starts, and tries to communicate with port 9000 (default) ● Provides all kinds of goodies we’ll talk about!
  • 4. XDEBUG: Hey, anyone listening on ip address 127.0.0.1 and port 9000? If not, I’m just going to continue.. IDE: Hey XDEBUG, I’m here so hold on.. I’d like you to stop at these breakpoints if you get to them. XDEBUG: OK, I’ll reply back if I hit one of those breakpoints. XDEBUG: Hey, IDE I just hit breakpoint 2 and stopped.. What do you want me to do now? ... How XDebug communicates
  • 5. 1) Check if already installed (phpinfo()) 2) PECL pecl install xdebug (OR) HOMEBREW brew install php56-xdebug 3) Add xdebug module and settings to php.ini* *The php.ini you have for cli (drush) is often different than your Apache php.ini Installing Xdebug
  • 6. You need to know the right ip address to connect to! Are you running php local or remotely? Running Local (127.0.0.1) Running remote (192.168.X.1) XAMP/WAMP etc Acquia Dev Desktop OSX native php Homebrew php DrupalVM Vagrant VirtualBox Docker Remote Server
  • 7. Check phpinfo() or php -i | grep xdebug zend_extension=/.../xdebug.so xdebug.remote_enable=On xdebug.remote_host=192.168.99.1 xdebug.remote_autostart=1 xdebug.remote_port=9000 xdebug.idekey="netbeans-xdebug" xdebug.max_nesting_level=256 Php.ini Xdebug settings
  • 8. heliocore.com Frank Carey CEO - Co-founder Debugging without Xdebug
  • 9. Debugging Without XDebug ● var_dump(), print_r(), echo() ● drupal_set_message() ● Devel Module: ○ dpm/dsm() ○ drupal_debug()
  • 10. Example dpm() output using Devel module.
  • 11. ● Shooting in the dark / trial and error ● Pollutes screen ● Memory intensive ● Requires altering your code (and remembering to clean it up) ● dpm() not reliable ● Very limited functionality ○ Can’t pause execution ○ Read only ○ One thread only Limitations of the Devel approach
  • 12. ● Requires an IDE (that has good support) ● Requires a PHP extension to be installed ● Requires ini settings ● Adds overhead to PHP when installed: ○ Drupal ○ Composer Limitations of Debugging with XDebug
  • 13. heliocore.com Frank Carey CEO - Co-founder Debugging WITH Xdebug
  • 14. ● Real-time debugging ○ Stepping through code ○ Inspecting variables ○ Call Stack ● Advanced Breakpoints ● Watches ● Changing Values on the fly! Features we’ll Demonstrate
  • 15. heliocore.com Frank Carey CEO - Co-founder Setting up PHPStorm (DEMO)
  • 16. heliocore.com Frank Carey CEO - Co-founder Watches (DEMO)
  • 17. heliocore.com Frank Carey CEO - Co-founder Debugging Basics (DEMO)
  • 18. heliocore.com Frank Carey CEO - Co-founder Advanced Breakpoints (DEMO)
  • 19. THANKS! Follow me @frankcarey Check out Ahoy 2.x at: bit.ly/ahoycli