SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
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
Our Goal
Understanding Debugging and Context
Evaluating, understanding, and
validating how your application works.
What is ‘debugging’?
var_dump()
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

Contenu connexe

Tendances

Ansible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL MeetupAnsible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL MeetupJeff Geerling
 
Rex - Lightning Talk yapc.eu 2013
Rex - Lightning Talk yapc.eu 2013Rex - Lightning Talk yapc.eu 2013
Rex - Lightning Talk yapc.eu 2013Jan Gehring
 
ChinaNetCloud - Zabbix Monitoring System Overview
ChinaNetCloud - Zabbix Monitoring System OverviewChinaNetCloud - Zabbix Monitoring System Overview
ChinaNetCloud - Zabbix Monitoring System OverviewChinaNetCloud
 
Caching basics in PHP
Caching basics in PHPCaching basics in PHP
Caching basics in PHPAnis Ahmad
 
Server Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.jsServer Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.jsJeff Geerling
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansibleDharmit Shah
 
About Caching
About CachingAbout Caching
About CachingWeng Wei
 
NginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniquesNginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniquesClaudio Borges
 
OSGi Community Event 2010 - Automated Semantic Versioning for OSGi Bundles
OSGi Community Event 2010 - Automated Semantic Versioning for OSGi BundlesOSGi Community Event 2010 - Automated Semantic Versioning for OSGi Bundles
OSGi Community Event 2010 - Automated Semantic Versioning for OSGi Bundlesmfrancis
 
Configuration Management - Finding the tool to fit your needs
Configuration Management - Finding the tool to fit your needsConfiguration Management - Finding the tool to fit your needs
Configuration Management - Finding the tool to fit your needsSaltStack
 
Introducing DeploYii 0.5
Introducing DeploYii 0.5Introducing DeploYii 0.5
Introducing DeploYii 0.5Giovanni Derks
 
Seguranca em APP Rails
Seguranca em APP RailsSeguranca em APP Rails
Seguranca em APP RailsDaniel Lopes
 
From Test to Live with Rex
From Test to Live with RexFrom Test to Live with Rex
From Test to Live with RexJan Gehring
 
Seedhack MongoDB 2011
Seedhack MongoDB 2011Seedhack MongoDB 2011
Seedhack MongoDB 2011Rainforest QA
 
Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)Deutsche Post
 
Introduction to selenium_grid_workshop
Introduction to selenium_grid_workshopIntroduction to selenium_grid_workshop
Introduction to selenium_grid_workshopseleniumconf
 

Tendances (20)

Ansible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL MeetupAnsible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL Meetup
 
Ansible
AnsibleAnsible
Ansible
 
Mini-Training: To cache or not to cache
Mini-Training: To cache or not to cacheMini-Training: To cache or not to cache
Mini-Training: To cache or not to cache
 
Rex - Lightning Talk yapc.eu 2013
Rex - Lightning Talk yapc.eu 2013Rex - Lightning Talk yapc.eu 2013
Rex - Lightning Talk yapc.eu 2013
 
ChinaNetCloud - Zabbix Monitoring System Overview
ChinaNetCloud - Zabbix Monitoring System OverviewChinaNetCloud - Zabbix Monitoring System Overview
ChinaNetCloud - Zabbix Monitoring System Overview
 
Caching basics in PHP
Caching basics in PHPCaching basics in PHP
Caching basics in PHP
 
Server Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.jsServer Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.js
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Vault
VaultVault
Vault
 
About Caching
About CachingAbout Caching
About Caching
 
NginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniquesNginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniques
 
OSGi Community Event 2010 - Automated Semantic Versioning for OSGi Bundles
OSGi Community Event 2010 - Automated Semantic Versioning for OSGi BundlesOSGi Community Event 2010 - Automated Semantic Versioning for OSGi Bundles
OSGi Community Event 2010 - Automated Semantic Versioning for OSGi Bundles
 
Configuration Management - Finding the tool to fit your needs
Configuration Management - Finding the tool to fit your needsConfiguration Management - Finding the tool to fit your needs
Configuration Management - Finding the tool to fit your needs
 
Introducing DeploYii 0.5
Introducing DeploYii 0.5Introducing DeploYii 0.5
Introducing DeploYii 0.5
 
Seguranca em APP Rails
Seguranca em APP RailsSeguranca em APP Rails
Seguranca em APP Rails
 
From Test to Live with Rex
From Test to Live with RexFrom Test to Live with Rex
From Test to Live with Rex
 
Seedhack MongoDB 2011
Seedhack MongoDB 2011Seedhack MongoDB 2011
Seedhack MongoDB 2011
 
Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)Javascript Test Automation Workshop (21.08.2014)
Javascript Test Automation Workshop (21.08.2014)
 
Ansible in CI
Ansible in CIAnsible in CI
Ansible in CI
 
Introduction to selenium_grid_workshop
Introduction to selenium_grid_workshopIntroduction to selenium_grid_workshop
Introduction to selenium_grid_workshop
 

En vedette

Ejercicio 17 pag 87
Ejercicio 17 pag 87Ejercicio 17 pag 87
Ejercicio 17 pag 87laurads12
 
Real Estate Resume
Real Estate ResumeReal Estate Resume
Real Estate ResumeLeigh Disney
 
Julkisuus osana asiantuntijatyötä 15.1.2014
Julkisuus osana asiantuntijatyötä 15.1.2014Julkisuus osana asiantuntijatyötä 15.1.2014
Julkisuus osana asiantuntijatyötä 15.1.2014Eläketurvakeskus
 
Debugging WooCommerce - WooConf Talk
Debugging WooCommerce - WooConf TalkDebugging WooCommerce - WooConf Talk
Debugging WooCommerce - WooConf TalkAndrew Wikel
 
ahsan habib paper
ahsan habib paperahsan habib paper
ahsan habib paperahsan habib
 
Rapport_SISTA_VERSION
Rapport_SISTA_VERSIONRapport_SISTA_VERSION
Rapport_SISTA_VERSIONKika Diestre
 
La colaboración público-privada en los entes mixtos locales de gestión y pro...
 La colaboración público-privada en los entes mixtos locales de gestión y pro... La colaboración público-privada en los entes mixtos locales de gestión y pro...
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
UNWTO Global Report on Meetings Industry 2013UNWTO Global Report on Meetings Industry 2013
UNWTO Global Report on Meetings Industry 2013David Vicent
 
Inversión en Viajes y Turismo en las Américas. Estudio WTTC 2014
Inversión en Viajes y Turismo en las Américas. Estudio WTTC 2014Inversión en Viajes y Turismo en las Américas. Estudio WTTC 2014
Inversión en Viajes y Turismo en las Américas. Estudio WTTC 2014David Vicent
 
Citizen Evaluation of Property Development
Citizen Evaluation of Property DevelopmentCitizen Evaluation of Property Development
Citizen Evaluation of Property Developmentglennweiss
 
A new approach to b2b marketing in professional services
A new approach to b2b marketing in professional servicesA new approach to b2b marketing in professional services
A new approach to b2b marketing in professional servicesRick VARGAS
 
ανακυκλωση
ανακυκλωσηανακυκλωση
ανακυκλωσηΕιρήνη
 

En vedette (14)

NYHTbrochurePRINT
NYHTbrochurePRINTNYHTbrochurePRINT
NYHTbrochurePRINT
 
Ejercicio 17 pag 87
Ejercicio 17 pag 87Ejercicio 17 pag 87
Ejercicio 17 pag 87
 
Real Estate Resume
Real Estate ResumeReal Estate Resume
Real Estate Resume
 
Julkisuus osana asiantuntijatyötä 15.1.2014
Julkisuus osana asiantuntijatyötä 15.1.2014Julkisuus osana asiantuntijatyötä 15.1.2014
Julkisuus osana asiantuntijatyötä 15.1.2014
 
Debugging WooCommerce - WooConf Talk
Debugging WooCommerce - WooConf TalkDebugging WooCommerce - WooConf Talk
Debugging WooCommerce - WooConf Talk
 
ahsan habib paper
ahsan habib paperahsan habib paper
ahsan habib paper
 
Actividad 3
Actividad 3Actividad 3
Actividad 3
 
Rapport_SISTA_VERSION
Rapport_SISTA_VERSIONRapport_SISTA_VERSION
Rapport_SISTA_VERSION
 
La colaboración público-privada en los entes mixtos locales de gestión y pro...
 La colaboración público-privada en los entes mixtos locales de gestión y pro... La colaboración público-privada en los entes mixtos locales de gestión y pro...
La colaboración público-privada en los entes mixtos locales de gestión y pro...
 
UNWTO Global Report on Meetings Industry 2013
UNWTO Global Report on Meetings Industry 2013UNWTO Global Report on Meetings Industry 2013
UNWTO Global Report on Meetings Industry 2013
 
Inversión en Viajes y Turismo en las Américas. Estudio WTTC 2014
Inversión en Viajes y Turismo en las Américas. Estudio WTTC 2014Inversión en Viajes y Turismo en las Américas. Estudio WTTC 2014
Inversión en Viajes y Turismo en las Américas. Estudio WTTC 2014
 
Citizen Evaluation of Property Development
Citizen Evaluation of Property DevelopmentCitizen Evaluation of Property Development
Citizen Evaluation of Property Development
 
A new approach to b2b marketing in professional services
A new approach to b2b marketing in professional servicesA new approach to b2b marketing in professional services
A new approach to b2b marketing in professional services
 
ανακυκλωση
ανακυκλωσηανακυκλωση
ανακυκλωση
 

Similaire à Getting Started With Xdebug

doing_it_right() with WordPress
doing_it_right() with WordPressdoing_it_right() with WordPress
doing_it_right() with WordPressryanduff
 
Here Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressHere Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressRami Sayar
 
DCRUG: Achieving Development-Production Parity
DCRUG: Achieving Development-Production ParityDCRUG: Achieving Development-Production Parity
DCRUG: Achieving Development-Production ParityGeoff Harcourt
 
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 codeAdam Englander
 
Php code profiling_using_x_debug
Php code profiling_using_x_debugPhp code profiling_using_x_debug
Php code profiling_using_x_debugGennady Feldman
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefNathen Harvey
 
WordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best PracticesWordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best Practicesryanduff
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011Bachkoutou Toutou
 
Benefits of an Open environment with Wakanda
Benefits of an Open environment with WakandaBenefits of an Open environment with Wakanda
Benefits of an Open environment with WakandaAlexandre Morgaut
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescueMarko Heijnen
 
(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 Systemssosorry
 
Middleware in Golang: InVision's Rye
Middleware in Golang: InVision's RyeMiddleware in Golang: InVision's Rye
Middleware in Golang: InVision's RyeCale Hoopes
 

Similaire à Getting Started With Xdebug (20)

doing_it_right() with WordPress
doing_it_right() with WordPressdoing_it_right() with WordPress
doing_it_right() with WordPress
 
Here Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressHere Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPress
 
DCRUG: Achieving Development-Production Parity
DCRUG: Achieving Development-Production ParityDCRUG: Achieving Development-Production Parity
DCRUG: Achieving Development-Production Parity
 
Xdebug
XdebugXdebug
Xdebug
 
Zend Framwork configurations
Zend Framwork configurationsZend Framwork configurations
Zend Framwork configurations
 
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
 
Php code profiling_using_x_debug
Php code profiling_using_x_debugPhp code profiling_using_x_debug
Php code profiling_using_x_debug
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
Web Fundamental
Web FundamentalWeb Fundamental
Web Fundamental
 
WordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best PracticesWordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best Practices
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011
 
Continuous feature-development
Continuous feature-developmentContinuous feature-development
Continuous feature-development
 
Benefits of an Open environment with Wakanda
Benefits of an Open environment with WakandaBenefits of an Open environment with Wakanda
Benefits of an Open environment with Wakanda
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescue
 
Improving qa on php projects
Improving qa on php projectsImproving qa on php projects
Improving qa on php projects
 
PHP Profiling/performance
PHP Profiling/performancePHP Profiling/performance
PHP Profiling/performance
 
Nodejs web,db,hosting
Nodejs web,db,hostingNodejs web,db,hosting
Nodejs web,db,hosting
 
Php reports sumit
Php reports sumitPhp reports sumit
Php reports sumit
 
(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
 
Middleware in Golang: InVision's Rye
Middleware in Golang: InVision's RyeMiddleware in Golang: InVision's Rye
Middleware in Golang: InVision's Rye
 

Dernier

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Dernier (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

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
  • 4.
  • 6.
  • 8. Evaluating, understanding, and validating how your application works. What is ‘debugging’?
  • 10.
  • 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