SlideShare a Scribd company logo
1 of 21
Download to read offline
XDebug -> PHPStorm
XDebug Integration to PHP Storm
What is XDebug ?

•  is a PHP extension that was written
• 
• 

and is maintained by Derick
Rethans
provides debugging and profiling
capabilities
you can set a breakpoint and pause
the execution of a script
What is XDebug ?

•  use to avoid var_dump, print_r
and echo for debugging

•  completely replaces the need to litter
your code with echo, print_r() or
var_dump() calls, and displays
information on all variables, not just
the one you passed.
IDE Support

•  PHP Storm
•  Sublime Text 2
•  Notepad++
•  Vim
Installation
Ubuntu
sudo apt-get install php5-dev php-pear
Install xdebug thru PECL
o  sudo pecl install xdebug
Then edit php.in add:
o  zend_extension="/usr/lib/php5/20060613/xdebug.so"
o  [xdebug]
o  xdebug.file_link_format="txmt://open?url=file://
%f&line=%1"
o  xdebug.remote_enable = On
o  xdebug.remote_autostart = 1

• 
• 
• 

• 

restart apache : sudo /etc/init.d/apache2 restart
Installation
Ubuntu

•  xdebug.profiler_̲enable  =  1
xdebug.profiler_̲output_̲name  =  xdebug.out.%t
xdebug.profiler_̲output_̲dir  =  /tmp

• 

xdebug.profiler_̲enable_̲trigger  =  1
restart apache : sudo /etc/init.d/apache2 restart
Installation
Mac (Using precompiled binaries)
cd /tmp/
curl http://xdebug.org/files/xdebug-2.2.1.tgz >
xdebug.tgz
tar -xvzf xdebug.tgz
cd xdebug-2.2.1
phpize
./configure
make
make install

• 
• 
• 
• 
• 
• 
• 
• 
Installation
Mac (Using precompiled binaries)

•  on php.ini add the following line:

o  zend_extension="/usr/lib/php5/20060613/xdebug.so"
o  [xdebug]
o  xdebug.file_link_format="txmt://open?
url=file://%f&line=%1"
o  xdebug.remote_enable = On
o  xdebug.remote_autostart = 1

•  Restart Apache
Installation
Windows

•  Download appropriate xdebug version in
http://xdebug.org/download.php
•  Save the .dll file to apache/modules folder
•  On php.ini add the following lines

• 

o  zend_extension="path/to/xdebug.dll"
o  [xdebug]
o  xdebug.remote_enable = On
o  xdebug.remote_autostart = 1
Restart Apache
Implement Xdebug to Php Storm
• 
• 

Application -> Preferences -> PHP -> Debug -> DBGP Proxy
Set Port to 9000 is recommended
Install XDebug Helper
• 

• 

https://chrome.google.com/webstore/search/xdebug

Once you’ve installed the extension, right click the little bug appearing in
your address bar and go to the options.
Install XDebug Helper
• 
• 

Set IDE key to PHPSTORM
Set Domain Filter *.local
Install XDebug Helper
• 
• 

After configuring right click the icon on your address bar
Click Debug
Start XDebug Session
•  Click the “Start Listen PHP Debug Connections” button:
•  add breakpoints by clicking the space next to the line
numbers on the left hand side
Implement Xdebug to Php Storm
• 

If everything goes according to plan, this window should pop up inside of
PhpStorm to inform you of an incoming debug connection:
Tools
• 
• 
• 
• 
• 

Resume Program (F9) — Clicking on this green arrow
allows script execution to proceed to next breakpoint if you
have any more, or to end of script as it normally would.
Stop (CTRL + F2) — Immediately halts script execution.
Step Over (F8) — Goes to the next PHP line in current file.
Does not go into method calls made within current context.
Step Into (F7) — Goes to the next PHP line in current
execution, not just the file. Dives into any method calls made,
giving far more detail than Step Over.
Step Out - If you stepped into a function and want to get out
before the end is reached, just step out.
Tools
•  Variables — Displays all available variables, including
objects, arrays or simple variables, at the current breakpoint.

• 
• 

Editing Variable - You can edit variables without reloading
the page.
Run to Cursor - Run the specific line where the cursor is
located.
Profiling
•  Tools -> Analyze XDebug Profiler Snapshot
• 

Locate the file that used in config
a.  ex. /tmp/xdebug.out.1385202363
XDebug -> Sublime Text2
XDebug Integration to Sublime Text2
Download XDebug Plugin
•  Install Package Control
a.  https://sublime.wbond.net/installation
b.  control + ~
c.  Paste the python code to console

• 
• 
• 
• 

Open Package Manager (Command + Shift + p)
Type Install Package
Look for Kindari/SublimeXdebug
On XDebug Helper for IDE Key
a.  sublime.xdebug
Sublime XDebug Shortcut
Keys
•  Shift+f8: Open XDebug quick panel
• 
• 
• 
• 
• 
• 

f8: Open XDebug control quick panel when debugger is
connected
Ctrl+f8: Toggle breakpoint
Ctrl+Shift+f5: Run to next breakpoint
Ctrl+Shift+f6: Step over
Ctrl+Shift+f7: Step into
Ctrl+Shift+f8: Step out

More Related Content

What's hot

Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11
Combell NV
 
PM : code faster
PM : code fasterPM : code faster
PM : code faster
PHPPRO
 

What's hot (20)

Final opensource record 2019
Final opensource record 2019Final opensource record 2019
Final opensource record 2019
 
Automatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themesAutomatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themes
 
Xdebug from a to x
Xdebug from a to xXdebug from a to x
Xdebug from a to x
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 
SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)
 
Quick flask an intro to flask
Quick flask   an intro to flaskQuick flask   an intro to flask
Quick flask an intro to flask
 
Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11
 
Debugging, Monitoring and Profiling in TYPO3
Debugging, Monitoring and Profiling in TYPO3Debugging, Monitoring and Profiling in TYPO3
Debugging, Monitoring and Profiling in TYPO3
 
Pwning with powershell
Pwning with powershellPwning with powershell
Pwning with powershell
 
Php Power Tools
Php Power ToolsPhp Power Tools
Php Power Tools
 
David Rey Lessons Learned Updating Content Licensing To Be Plone 3 Compat...
David Rey   Lessons Learned   Updating Content Licensing To Be Plone 3 Compat...David Rey   Lessons Learned   Updating Content Licensing To Be Plone 3 Compat...
David Rey Lessons Learned Updating Content Licensing To Be Plone 3 Compat...
 
Modern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl ProgrammerModern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl Programmer
 
Practical PHP Deployment with Jenkins
Practical PHP Deployment with JenkinsPractical PHP Deployment with Jenkins
Practical PHP Deployment with Jenkins
 
Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015
 
The typo3.org Relaunch Project
The typo3.org Relaunch ProjectThe typo3.org Relaunch Project
The typo3.org Relaunch Project
 
PM : code faster
PM : code fasterPM : code faster
PM : code faster
 
Philipp Von Weitershausen Plone Age Mammoths, Sabers And Caveen Cant The...
Philipp Von Weitershausen   Plone Age  Mammoths, Sabers And Caveen   Cant The...Philipp Von Weitershausen   Plone Age  Mammoths, Sabers And Caveen   Cant The...
Philipp Von Weitershausen Plone Age Mammoths, Sabers And Caveen Cant The...
 
Web backends development using Python
Web backends development using PythonWeb backends development using Python
Web backends development using Python
 
Gael Le Mignot How To Minimize Cpu And Memory Usage Of Zope And Plone Appli...
Gael Le Mignot   How To Minimize Cpu And Memory Usage Of Zope And Plone Appli...Gael Le Mignot   How To Minimize Cpu And Memory Usage Of Zope And Plone Appli...
Gael Le Mignot How To Minimize Cpu And Memory Usage Of Zope And Plone Appli...
 
Php intro
Php introPhp intro
Php intro
 

Viewers also liked

Powerpoint coneixement del medi pablo blasco
Powerpoint coneixement del medi   pablo blascoPowerpoint coneixement del medi   pablo blasco
Powerpoint coneixement del medi pablo blasco
Pablo Blasco
 
torre de papel y carton
torre de papel y cartontorre de papel y carton
torre de papel y carton
06121996
 
25 sayings grammar practice
25 sayings grammar practice25 sayings grammar practice
25 sayings grammar practice
Brett Vaden
 
Bakshanam kazhikkumpol orkkenda sunnathukal
Bakshanam kazhikkumpol orkkenda sunnathukal Bakshanam kazhikkumpol orkkenda sunnathukal
Bakshanam kazhikkumpol orkkenda sunnathukal
shabeel pn
 
Dich web anh an 2
Dich web anh an 2Dich web anh an 2
Dich web anh an 2
upa098
 
Geo Sol About Geo Thermal
Geo Sol  About Geo ThermalGeo Sol  About Geo Thermal
Geo Sol About Geo Thermal
Knut Linke
 

Viewers also liked (20)

Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in Yii
 
Presentation
PresentationPresentation
Presentation
 
Vertical Rhythm and Modular Scale: Typesettings
Vertical Rhythm and Modular Scale: TypesettingsVertical Rhythm and Modular Scale: Typesettings
Vertical Rhythm and Modular Scale: Typesettings
 
PHP Unit Testing in Yii
PHP Unit Testing in YiiPHP Unit Testing in Yii
PHP Unit Testing in Yii
 
Vertical rhythm
Vertical rhythm Vertical rhythm
Vertical rhythm
 
Imágenes para los evangelios del curso 2015-2016
Imágenes para los evangelios del curso 2015-2016Imágenes para los evangelios del curso 2015-2016
Imágenes para los evangelios del curso 2015-2016
 
Empresas ecológicas
Empresas ecológicasEmpresas ecológicas
Empresas ecológicas
 
Powerpoint coneixement del medi pablo blasco
Powerpoint coneixement del medi   pablo blascoPowerpoint coneixement del medi   pablo blasco
Powerpoint coneixement del medi pablo blasco
 
torre de papel y carton
torre de papel y cartontorre de papel y carton
torre de papel y carton
 
Diari del 14 de maig de 2015
Diari del 14 de maig de 2015Diari del 14 de maig de 2015
Diari del 14 de maig de 2015
 
54 ozel
54 ozel54 ozel
54 ozel
 
Bitcoin meetup Paralelní Polis - O stavebních kamenech
Bitcoin meetup Paralelní Polis - O stavebních kamenechBitcoin meetup Paralelní Polis - O stavebních kamenech
Bitcoin meetup Paralelní Polis - O stavebních kamenech
 
25 sayings grammar practice
25 sayings grammar practice25 sayings grammar practice
25 sayings grammar practice
 
Evaluacion y formulacion de proyectos
Evaluacion y formulacion de proyectosEvaluacion y formulacion de proyectos
Evaluacion y formulacion de proyectos
 
La justicia
La justiciaLa justicia
La justicia
 
Bakshanam kazhikkumpol orkkenda sunnathukal
Bakshanam kazhikkumpol orkkenda sunnathukal Bakshanam kazhikkumpol orkkenda sunnathukal
Bakshanam kazhikkumpol orkkenda sunnathukal
 
Dich web anh an 2
Dich web anh an 2Dich web anh an 2
Dich web anh an 2
 
noble praxis tipps - telefon- und webkonferenzen
noble praxis tipps - telefon- und webkonferenzennoble praxis tipps - telefon- und webkonferenzen
noble praxis tipps - telefon- und webkonferenzen
 
Book drive Flyer
Book drive FlyerBook drive Flyer
Book drive Flyer
 
Geo Sol About Geo Thermal
Geo Sol  About Geo ThermalGeo Sol  About Geo Thermal
Geo Sol About Geo Thermal
 

Similar to X-Debug in Php Storm

Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
tutorialsruby
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
tutorialsruby
 
Python debuggers slides
Python debuggers slidesPython debuggers slides
Python debuggers slides
mattboehm
 
Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13
DanWooster1
 
Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshop
julien pauli
 
Php tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPhp tutorial from_beginner_to_master
Php tutorial from_beginner_to_master
PrinceGuru MS
 

Similar to X-Debug in Php Storm (20)

Php
PhpPhp
Php
 
Php ppt
Php pptPhp ppt
Php ppt
 
IPC 2013 - High Performance PHP with HipHop
IPC 2013 - High Performance PHP with HipHopIPC 2013 - High Performance PHP with HipHop
IPC 2013 - High Performance PHP with HipHop
 
Php through the eyes of a hoster
Php through the eyes of a hosterPhp through the eyes of a hoster
Php through the eyes of a hoster
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8
 
PHP ITCS 323
PHP ITCS 323PHP ITCS 323
PHP ITCS 323
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 
Php training100%placement-in-mumbai
Php training100%placement-in-mumbaiPhp training100%placement-in-mumbai
Php training100%placement-in-mumbai
 
Python debuggers slides
Python debuggers slidesPython debuggers slides
Python debuggers slides
 
Code Igniter Code Sniffer
Code Igniter  Code SnifferCode Igniter  Code Sniffer
Code Igniter Code Sniffer
 
Debugging and Profiling PHP Applications
Debugging and Profiling PHP ApplicationsDebugging and Profiling PHP Applications
Debugging and Profiling PHP Applications
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
 
Php Ppt
Php PptPhp Ppt
Php Ppt
 
Php through the eyes of a hoster: PHPNW10
Php through the eyes of a hoster: PHPNW10Php through the eyes of a hoster: PHPNW10
Php through the eyes of a hoster: PHPNW10
 
Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshop
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4
 
Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshop
 
Php tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPhp tutorial from_beginner_to_master
Php tutorial from_beginner_to_master
 

More from KLabCyscorpions-TechBlog

More from KLabCyscorpions-TechBlog (13)

Object Calisthenics in Objective-C
Object Calisthenics in Objective-CObject Calisthenics in Objective-C
Object Calisthenics in Objective-C
 
Auto Layout on Xcode 5
Auto Layout on Xcode 5Auto Layout on Xcode 5
Auto Layout on Xcode 5
 
Code Review for iOS
Code Review for iOSCode Review for iOS
Code Review for iOS
 
Object Calisthenics
Object CalisthenicsObject Calisthenics
Object Calisthenics
 
Why You're A Bad PHP Programmer
Why You're A Bad PHP ProgrammerWhy You're A Bad PHP Programmer
Why You're A Bad PHP Programmer
 
Redis Set Go
Redis Set GoRedis Set Go
Redis Set Go
 
Redis Beyond
Redis BeyondRedis Beyond
Redis Beyond
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Php + MySql Optimization
Php + MySql OptimizationPhp + MySql Optimization
Php + MySql Optimization
 
Mysql Optimization
Mysql OptimizationMysql Optimization
Mysql Optimization
 
MVC Web Application
MVC Web ApplicationMVC Web Application
MVC Web Application
 
AfNetworking vs. Native + Caching
AfNetworking vs. Native + CachingAfNetworking vs. Native + Caching
AfNetworking vs. Native + Caching
 
Bash
BashBash
Bash
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 

X-Debug in Php Storm

  • 1. XDebug -> PHPStorm XDebug Integration to PHP Storm
  • 2. What is XDebug ? •  is a PHP extension that was written •  •  and is maintained by Derick Rethans provides debugging and profiling capabilities you can set a breakpoint and pause the execution of a script
  • 3. What is XDebug ? •  use to avoid var_dump, print_r and echo for debugging •  completely replaces the need to litter your code with echo, print_r() or var_dump() calls, and displays information on all variables, not just the one you passed.
  • 4. IDE Support •  PHP Storm •  Sublime Text 2 •  Notepad++ •  Vim
  • 5. Installation Ubuntu sudo apt-get install php5-dev php-pear Install xdebug thru PECL o  sudo pecl install xdebug Then edit php.in add: o  zend_extension="/usr/lib/php5/20060613/xdebug.so" o  [xdebug] o  xdebug.file_link_format="txmt://open?url=file:// %f&line=%1" o  xdebug.remote_enable = On o  xdebug.remote_autostart = 1 •  •  •  •  restart apache : sudo /etc/init.d/apache2 restart
  • 6. Installation Ubuntu •  xdebug.profiler_̲enable  =  1 xdebug.profiler_̲output_̲name  =  xdebug.out.%t xdebug.profiler_̲output_̲dir  =  /tmp •  xdebug.profiler_̲enable_̲trigger  =  1 restart apache : sudo /etc/init.d/apache2 restart
  • 7. Installation Mac (Using precompiled binaries) cd /tmp/ curl http://xdebug.org/files/xdebug-2.2.1.tgz > xdebug.tgz tar -xvzf xdebug.tgz cd xdebug-2.2.1 phpize ./configure make make install •  •  •  •  •  •  •  • 
  • 8. Installation Mac (Using precompiled binaries) •  on php.ini add the following line: o  zend_extension="/usr/lib/php5/20060613/xdebug.so" o  [xdebug] o  xdebug.file_link_format="txmt://open? url=file://%f&line=%1" o  xdebug.remote_enable = On o  xdebug.remote_autostart = 1 •  Restart Apache
  • 9. Installation Windows •  Download appropriate xdebug version in http://xdebug.org/download.php •  Save the .dll file to apache/modules folder •  On php.ini add the following lines •  o  zend_extension="path/to/xdebug.dll" o  [xdebug] o  xdebug.remote_enable = On o  xdebug.remote_autostart = 1 Restart Apache
  • 10. Implement Xdebug to Php Storm •  •  Application -> Preferences -> PHP -> Debug -> DBGP Proxy Set Port to 9000 is recommended
  • 11. Install XDebug Helper •  •  https://chrome.google.com/webstore/search/xdebug Once you’ve installed the extension, right click the little bug appearing in your address bar and go to the options.
  • 12. Install XDebug Helper •  •  Set IDE key to PHPSTORM Set Domain Filter *.local
  • 13. Install XDebug Helper •  •  After configuring right click the icon on your address bar Click Debug
  • 14. Start XDebug Session •  Click the “Start Listen PHP Debug Connections” button: •  add breakpoints by clicking the space next to the line numbers on the left hand side
  • 15. Implement Xdebug to Php Storm •  If everything goes according to plan, this window should pop up inside of PhpStorm to inform you of an incoming debug connection:
  • 16. Tools •  •  •  •  •  Resume Program (F9) — Clicking on this green arrow allows script execution to proceed to next breakpoint if you have any more, or to end of script as it normally would. Stop (CTRL + F2) — Immediately halts script execution. Step Over (F8) — Goes to the next PHP line in current file. Does not go into method calls made within current context. Step Into (F7) — Goes to the next PHP line in current execution, not just the file. Dives into any method calls made, giving far more detail than Step Over. Step Out - If you stepped into a function and want to get out before the end is reached, just step out.
  • 17. Tools •  Variables — Displays all available variables, including objects, arrays or simple variables, at the current breakpoint. •  •  Editing Variable - You can edit variables without reloading the page. Run to Cursor - Run the specific line where the cursor is located.
  • 18. Profiling •  Tools -> Analyze XDebug Profiler Snapshot •  Locate the file that used in config a.  ex. /tmp/xdebug.out.1385202363
  • 19. XDebug -> Sublime Text2 XDebug Integration to Sublime Text2
  • 20. Download XDebug Plugin •  Install Package Control a.  https://sublime.wbond.net/installation b.  control + ~ c.  Paste the python code to console •  •  •  •  Open Package Manager (Command + Shift + p) Type Install Package Look for Kindari/SublimeXdebug On XDebug Helper for IDE Key a.  sublime.xdebug
  • 21. Sublime XDebug Shortcut Keys •  Shift+f8: Open XDebug quick panel •  •  •  •  •  •  f8: Open XDebug control quick panel when debugger is connected Ctrl+f8: Toggle breakpoint Ctrl+Shift+f5: Run to next breakpoint Ctrl+Shift+f6: Step over Ctrl+Shift+f7: Step into Ctrl+Shift+f8: Step out