SlideShare a Scribd company logo
Debugging
WordPress
With xDebug
Alex James Bishop
@aj-adl
Huge thanks to the Organisers
and Sponsors!
Using xDebug to profile our
code and pinpoint bottlenecks
Using xDebug to debug our
(WordPress) applications
Using xDebug to help
develop features
Delivering higher-quality
data to you as the developer
The Land Before Time
xDebug
Late May, the Year 2000…
🎉🎉🎉🎉
🎉
Debugging WordPress with xDebug
Debugging WordPress with xDebug
Debugging WordPress with xDebug
V4.0 !!! Now with added programming language!
var_dump( $variable );
It’s been a little while since
2000…
Debugging WordPress with xDebug
var_dump( $variable );
Debugging WordPress with xDebug
• xDebug offers lots of utility
• xDebug does take some time to setupvar_dump( $variable );
error_log( $variable );
Print based debugging
Echo / Print based debugging
• Only gives us values for chosen variables
• Doesn’t show us the rest of the current scope
• Captures variables at single point in time
To use an analogy..
To use an analogy..
Step-through debugging
• Stops the execution at a certain (break) point.
• Ability to inspect all variables in current scope
• See current call stack leading to breakpoint
• Advance through the execution to see changes over time
Debugging WordPress with xDebug
Echo based debugging
requires modifying your
code..
$would_do = anything_for_love();
//var_dump( $would_do );
if ( $would_do === $that ){
//var_dump(“wont’t do that”);
return false;
}
Sometimes we can forget to
remove them too…
Debugging WordPress with xDebug
Debugging WordPress with xDebug
Debugging WordPress with xDebug
https://xdebug.org/
xDebug can do a lot
• Makes ‘var_dump’ better!
• Code profiling to measure performance
• Step-through debugging using DBGp protocol
Profiling with xDebug
Check out Otto’s talk at WC EU
xdebug.profile_output_dir
Profiling: pro-tip for VM users
Remote debugging 💅🏼
Getting started
• xDebug extension installed in our development
environment
• xDebug client (standalone or IDE)
• Correct Configuration of both
Choose your Pokemon
Local Development Environment
Debugging WordPress with xDebug
Debugging WordPress with xDebug
Debugging WordPress with xDebug
Debugging WordPress with xDebug
Debugging WordPress with xDebug
Choose your IDE
Debugging WordPress with xDebug
Debugging WordPress with xDebug
Bonus Tip: Browser Extensions!
Debugging WordPress with xDebug
Help with configuration
IDE Configuration
Debugging WordPress with xDebug
Debugging WordPress with xDebug
Debugging WordPress with xDebug
Debugging WordPress with xDebug
Config for both IDEs can be set at a
global and per-project level
The remote debugging request flow
(or CLI )
xdebug.default_enable
xdebug.remote_enable
xdebug.remote_autostart
?XDEBUG_SESSIONS_START={id}
XDEBUG_SESSION cookie
xdebug.remote_port
xdebug.remote_host
xdebug.remote_connect_back
DBGp request
xdebug.remote_port=9000
Hello…. Is it DGBp you’re looking for?
DBGp request
Breakpoints
Debugging WordPress with xDebug
Debugging WordPress with xDebug
Components of an xDebug Client
Call Stack
Variables
Watches
Console
Debugging Actions
The importance of state and
timing
Pluging development examples
• WooCommerce (core) & Extensions
• Gravity Forms
• View layers, MVC frameworks etc
Should I use xdebug?
if( $utility > $implementation ){
use_the_new_thing();
}
Detailed setup guides are on
the way
Debugging WordPress with xDebug
Q & A
Thank You

More Related Content

PPTX
Universal react
PPTX
Javascript
PDF
Real world Python+django
PDF
Writing your First Ansible Playbook
PDF
CoffeeScript, An Introduction for Nodejs developers
PDF
Cucumber.js: Cuke up your JavaScript!
PDF
Deploy like a pro!
PPTX
Cucumber Jruby for BEginners
Universal react
Javascript
Real world Python+django
Writing your First Ansible Playbook
CoffeeScript, An Introduction for Nodejs developers
Cucumber.js: Cuke up your JavaScript!
Deploy like a pro!
Cucumber Jruby for BEginners

What's hot (11)

PPTX
WP-CLI - A Good Friend of Developer
KEY
Refactoring.the.ruby.way
PPTX
WP-CLI Workshop at WordPress Meetup Cluj-Napoca
PPTX
Infrastructure as Code
PDF
Ship WordPress Projects Like a Boss
PPTX
Putting the 'ctions' in Azure Fun-ctions
PPTX
WordPress Migrations 101 - WordCamp Orlando
PDF
Cypress, charm and easy.
PDF
Cypress new old Selenium
KEY
Optimizing Your Site
PDF
Building Isomorphic JavaScript Apps - NDC 2015
WP-CLI - A Good Friend of Developer
Refactoring.the.ruby.way
WP-CLI Workshop at WordPress Meetup Cluj-Napoca
Infrastructure as Code
Ship WordPress Projects Like a Boss
Putting the 'ctions' in Azure Fun-ctions
WordPress Migrations 101 - WordCamp Orlando
Cypress, charm and easy.
Cypress new old Selenium
Optimizing Your Site
Building Isomorphic JavaScript Apps - NDC 2015
Ad

Similar to Debugging WordPress with xDebug (20)

PDF
Xdebug from a to x
PDF
Getting Started With Xdebug
PPTX
Xdebug - Your first, last, and best option for troubleshooting PHP code
PDF
PDF
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
PDF
Debugging PHP with Xdebug - PHPUK 2018
PPTX
Xdebug
PPTX
XDebug For php debugging
PDF
Debugging PHP with xDebug inside of Eclipse PDT 2.1
PDF
Debugging PHP With Xdebug
PDF
X-Debug in Php Storm
PDF
Debugging WordPress
ODP
Xdebug for Beginners
PDF
Introduction to Xdebug
PDF
PPTX
DDD (Debugger Driven Development)
ODP
Debugging With Php
PPTX
PHP Training Part1
PPT
Php Debugger
PDF
Continuous Integration In Php
Xdebug from a to x
Getting Started With Xdebug
Xdebug - Your first, last, and best option for troubleshooting PHP code
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Debugging PHP with Xdebug - PHPUK 2018
Xdebug
XDebug For php debugging
Debugging PHP with xDebug inside of Eclipse PDT 2.1
Debugging PHP With Xdebug
X-Debug in Php Storm
Debugging WordPress
Xdebug for Beginners
Introduction to Xdebug
DDD (Debugger Driven Development)
Debugging With Php
PHP Training Part1
Php Debugger
Continuous Integration In Php
Ad

More from WordCamp Sydney (20)

PDF
Don’t Panic: How To Troubleshoot Your WordPress Site
PDF
WordPress Hosting Survival Guide
PDF
Preparing For The Flood. How Do You Conduct Load Testing To Ready Your WordPr...
PDF
Goodbye Themes, Hello Elementor – Beyond Creating Basic Websites
PDF
Divi 4.x and WooCommerce Changes
PDF
Why No One Is Reading Your Blog Posts (And How To Change That)
PDF
Our Wild Journey Implementing A Headless WordPress Blog
PDF
Escaping Client Hell: 6 Practical Tips To Make Freelancing Fun Again
PDF
Planning Your Website Roadmap: Why Every Website Project Needs One To Save It...
PDF
Website Delivered – It’s The START Of The Relationship!
PDF
5 Steps To Avoiding Burnout: Creating A Healthy Work/Life Balance
PDF
The Healthy Baker - Flipping the Brief
PDF
Gutenberg Block Editor Tips & Tricks
PDF
Let's Get Engaged
PDF
The Science Of WordPress
PDF
Basics of Search Engine Optimisation
PDF
The Future of Web Content (an introduction to the new WordPress editor)
PDF
Beyond the Theme: Affirming the role of the designer in the WordPress ecosystem
PDF
5 Ecommerce Trends to Implement Now
PDF
Modern Local Environment for WordPress in 2018
Don’t Panic: How To Troubleshoot Your WordPress Site
WordPress Hosting Survival Guide
Preparing For The Flood. How Do You Conduct Load Testing To Ready Your WordPr...
Goodbye Themes, Hello Elementor – Beyond Creating Basic Websites
Divi 4.x and WooCommerce Changes
Why No One Is Reading Your Blog Posts (And How To Change That)
Our Wild Journey Implementing A Headless WordPress Blog
Escaping Client Hell: 6 Practical Tips To Make Freelancing Fun Again
Planning Your Website Roadmap: Why Every Website Project Needs One To Save It...
Website Delivered – It’s The START Of The Relationship!
5 Steps To Avoiding Burnout: Creating A Healthy Work/Life Balance
The Healthy Baker - Flipping the Brief
Gutenberg Block Editor Tips & Tricks
Let's Get Engaged
The Science Of WordPress
Basics of Search Engine Optimisation
The Future of Web Content (an introduction to the new WordPress editor)
Beyond the Theme: Affirming the role of the designer in the WordPress ecosystem
5 Ecommerce Trends to Implement Now
Modern Local Environment for WordPress in 2018

Recently uploaded (20)

PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PDF
Testing WebRTC applications at scale.pdf
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PDF
Introduction to the IoT system, how the IoT system works
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
DOCX
Unit-3 cyber security network security of internet system
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
international classification of diseases ICD-10 review PPT.pptx
PPTX
Introduction to Information and Communication Technology
PPTX
Internet___Basics___Styled_ presentation
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PPTX
innovation process that make everything different.pptx
introduction about ICD -10 & ICD-11 ppt.pptx
Testing WebRTC applications at scale.pdf
Slides PPTX World Game (s) Eco Economic Epochs.pptx
SAP Ariba Sourcing PPT for learning material
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
WebRTC in SignalWire - troubleshooting media negotiation
Introduction to the IoT system, how the IoT system works
Cloud-Scale Log Monitoring _ Datadog.pdf
Unit-3 cyber security network security of internet system
Design_with_Watersergyerge45hrbgre4top (1).ppt
international classification of diseases ICD-10 review PPT.pptx
Introduction to Information and Communication Technology
Internet___Basics___Styled_ presentation
Power Point - Lesson 3_2.pptx grad school presentation
SASE Traffic Flow - ZTNA Connector-1.pdf
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
Decoding a Decade: 10 Years of Applied CTI Discipline
innovation process that make everything different.pptx

Debugging WordPress with xDebug