SlideShare una empresa de Scribd logo
1 de 13
Debugging PHP with Xdebug
Be Professional debugger with xdebug
Omid Khosrojerdi
omidkh68@gmail.com 1
Debugging PHP with XDebug
Omid Khosrojerdi
omidkh68@gmail.com
1. Why Debugging ?
2. Debug tools
3. XDebug
• What is XDebug ?
• XDebug Enable [php.ini]
• How to Install XDebug
• How to use XDebug
• XDebug remote connect
• XDebug with phpStorm
• XDebug browser extension
• XDebug in IDEs
2
Debugging PHP with XDebug - Debug tools
Omid Khosrojerdi
omidkh68@gmail.com
• Var_dump()
• Print_r()
• echo
• Xdump
• Kint
• Pinba
• XDebug
• IDEs
• ....
3
Debugging PHP with XDebug – What is XDebug ?
Omid Khosrojerdi
omidkh68@gmail.com
What is XDebug ?
With dbgp protocol
4
Debugging PHP with XDebug - XDebug features
Omid Khosrojerdi
omidkh68@gmail.com
By Function :
xdebug_start_trace();
xdebug_stop_trace();
Automatically (php.ini) :
xdebug.auto_trace = “1”
Note : Can’t Using ini_set();
5
Debugging PHP with XDebug – XDebug Enable [php.ini]
Omid Khosrojerdi
omidkh68@gmail.com
• xdebug.default_enable=1
• xdebug.coverage_enable=1
• xdebug.profiler_enable = 1
• xdebug.remote_handler = dbgp
• Linux – Mac osx : xdebug.profiler_output_dir = "/tmp“
• Windows : xdebug.profiler_output_dir = “C:wamptmp“
• xdebug.remote_enable=1
• xdebug.remote_host=localhost
• xdebug.remote_port=9000
• xdebug.remote_autostart=1
• xdebug.show_local_vars=1
• xdebug.show_local_vars=On
• xdebug.collect_params=4
• xdebug.show_exception_trace=On
6
Debugging PHP with XDebug - How to Install XDebug ?
Omid Khosrojerdi
omidkh68@gmail.com
Installing with PEAR/PECL for unix/linux:
# pecl install xdebug
Installing From Source :
git clone git://github.com/xdebug/xdebug.git
Wamp OR Xampp OR Mamp Server :
Installed Built-in
7
Debugging PHP with XDebug - How to use XDebug ?
Omid Khosrojerdi
omidkh68@gmail.com
Example: return execute duration time
<?php
echo xdebug_time_index(), "n";
for ($i = 0; $i < 250000; $i++)
{
// do nothing
}
echo xdebug_time_index(), "n";
?>
Returns:
0.00038003921508789
0.76580691337585
8
NOTE :
ini_set('display_errors', ‘On');
Debugging PHP with XDebug – XDebug remote Connect
Omid Khosrojerdi
omidkh68@gmail.com 9
Debugging PHP with XDebug - XDebug browser extension
Omid Khosrojerdi
omidkh68@gmail.com
Chrome Extension
FirefoxAddons
10
https://addons.mozilla.org/en-US/firefox/addon/easy-xdebug/
https://chrome.google.com/webstore/detail/xdebug-
helper/eadndfjplgieldjbigjakmdgkmoaaaoc
Debugging PHP with XDebug - XDebug in IDEs
Omid Khosrojerdi
omidkh68@gmail.com
phpStorm :
https://www.jetbrains.com/phpstorm/webhelp/configuring-xdebug.html
Zend studio :
http://files.zend.com/help/Zend-Studio/content/installing_xdebug.htm
NetBeans :
https://netbeans.org/kb/docs/php/debugging.html
11
Debugging PHP with XDebug - References
Omid Khosrojerdi
omidkh68@gmail.com
http://xdebug.org/
http://coding.smashingmagazine.com/2009/01/20/50-extremely-useful-php-tools/
https://www.jetbrains.com/phpstorm/webhelp/configuring-xdebug.html
http://files.zend.com/help/Zend-Studio/content/installing_xdebug.htm
http://devzone.zend.com/1120/introducing-xdebug/
12
Debugging PHP with XDebug - Question
Omid Khosrojerdi
omidkh68@gmail.com
Question?
13

Más contenido relacionado

La actualidad más candente

Introduction to Django REST Framework, an easy way to build REST framework in...
Introduction to Django REST Framework, an easy way to build REST framework in...Introduction to Django REST Framework, an easy way to build REST framework in...
Introduction to Django REST Framework, an easy way to build REST framework in...Zhe Li
 
Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.Junichi Ishida
 
Getting Started With Xdebug
Getting Started With XdebugGetting Started With Xdebug
Getting Started With XdebugJeremy Ward
 
Php[tek] 2016 - BDD with Behat for Beginners
Php[tek] 2016 - BDD with Behat for BeginnersPhp[tek] 2016 - BDD with Behat for Beginners
Php[tek] 2016 - BDD with Behat for BeginnersAdam Englander
 
Back to the future: Isomorphic javascript applications
Back to the future:  Isomorphic javascript applicationsBack to the future:  Isomorphic javascript applications
Back to the future: Isomorphic javascript applicationsLuciano Colosio
 
Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of dockerPHP Indonesia
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentIrfan Maulana
 
Node js (runtime environment + js library) platform
Node js (runtime environment + js library) platformNode js (runtime environment + js library) platform
Node js (runtime environment + js library) platformSreenivas Kappala
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Clark Everetts
 
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...Caktus Group
 
Phalcon Framework: San Antonio Web Developers Group
Phalcon Framework: San Antonio Web Developers Group Phalcon Framework: San Antonio Web Developers Group
Phalcon Framework: San Antonio Web Developers Group jdfreeman11
 
Managing a Local WordPress Community, WordCamp Europe 2016
Managing a Local WordPress Community, WordCamp Europe 2016Managing a Local WordPress Community, WordCamp Europe 2016
Managing a Local WordPress Community, WordCamp Europe 2016Sergey Biryukov
 
Let's creating your own PHP (tejimaya version)
Let's creating your own PHP (tejimaya version)Let's creating your own PHP (tejimaya version)
Let's creating your own PHP (tejimaya version)Kousuke Ebihara
 
Scaling php - Intercon php
Scaling php - Intercon phpScaling php - Intercon php
Scaling php - Intercon phpHandrus Nogueira
 
Debugging PHP With Xdebug
Debugging PHP With XdebugDebugging PHP With Xdebug
Debugging PHP With XdebugMark Niebergall
 
Web development with Python
Web development with PythonWeb development with Python
Web development with PythonRaman Balyan
 

La actualidad más candente (20)

Introduction to Django REST Framework, an easy way to build REST framework in...
Introduction to Django REST Framework, an easy way to build REST framework in...Introduction to Django REST Framework, an easy way to build REST framework in...
Introduction to Django REST Framework, an easy way to build REST framework in...
 
BDD in PHP - Behat
BDD in PHP - BehatBDD in PHP - Behat
BDD in PHP - Behat
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
 
Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.
 
Getting Started With Xdebug
Getting Started With XdebugGetting Started With Xdebug
Getting Started With Xdebug
 
Php[tek] 2016 - BDD with Behat for Beginners
Php[tek] 2016 - BDD with Behat for BeginnersPhp[tek] 2016 - BDD with Behat for Beginners
Php[tek] 2016 - BDD with Behat for Beginners
 
Back to the future: Isomorphic javascript applications
Back to the future:  Isomorphic javascript applicationsBack to the future:  Isomorphic javascript applications
Back to the future: Isomorphic javascript applications
 
Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of docker
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
 
Node js (runtime environment + js library) platform
Node js (runtime environment + js library) platformNode js (runtime environment + js library) platform
Node js (runtime environment + js library) platform
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016
 
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
 
Phalcon Framework: San Antonio Web Developers Group
Phalcon Framework: San Antonio Web Developers Group Phalcon Framework: San Antonio Web Developers Group
Phalcon Framework: San Antonio Web Developers Group
 
Managing a Local WordPress Community, WordCamp Europe 2016
Managing a Local WordPress Community, WordCamp Europe 2016Managing a Local WordPress Community, WordCamp Europe 2016
Managing a Local WordPress Community, WordCamp Europe 2016
 
Let's creating your own PHP (tejimaya version)
Let's creating your own PHP (tejimaya version)Let's creating your own PHP (tejimaya version)
Let's creating your own PHP (tejimaya version)
 
Modularity problems
Modularity  problemsModularity  problems
Modularity problems
 
Scaling php - Intercon php
Scaling php - Intercon phpScaling php - Intercon php
Scaling php - Intercon php
 
Debugging PHP With Xdebug
Debugging PHP With XdebugDebugging PHP With Xdebug
Debugging PHP With Xdebug
 
Web development with Python
Web development with PythonWeb development with Python
Web development with Python
 
Hello npm
Hello npmHello npm
Hello npm
 

Similar a XDebug For php debugging

PHP: Debugger, Profiler and more
PHP: Debugger, Profiler and morePHP: Debugger, Profiler and more
PHP: Debugger, Profiler and moreVõ Duy Tuấn
 
7 Top PHP Development Tools For PHP Coding
7 Top PHP Development Tools For PHP Coding7 Top PHP Development Tools For PHP Coding
7 Top PHP Development Tools For PHP Codingknot sync
 
How to really obfuscate your pdf malware
How to really obfuscate   your pdf malwareHow to really obfuscate   your pdf malware
How to really obfuscate your pdf malwarezynamics GmbH
 
How to really obfuscate your pdf malware
How to really obfuscate your pdf malwareHow to really obfuscate your pdf malware
How to really obfuscate your pdf malwarezynamics GmbH
 
Php code profiling_using_x_debug
Php code profiling_using_x_debugPhp code profiling_using_x_debug
Php code profiling_using_x_debugGennady Feldman
 
PhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 PluginPhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 PluginHaehnchen
 
How to write good quality code
How to write good quality codeHow to write good quality code
How to write good quality codeHayden Bleasel
 
Learn to build a CodeIgniter Login and Registration with source code.pdf
Learn to build a CodeIgniter Login and Registration with source code.pdfLearn to build a CodeIgniter Login and Registration with source code.pdf
Learn to build a CodeIgniter Login and Registration with source code.pdfBe Problem Solver
 
Php Code Profiling Using X Debug
Php Code Profiling Using X DebugPhp Code Profiling Using X Debug
Php Code Profiling Using X DebugSergeyChernyshev
 
TDD BDD PHP - Sviluppo guidato dai test in PHP con phpspec
TDD BDD PHP - Sviluppo guidato dai test in PHP con phpspecTDD BDD PHP - Sviluppo guidato dai test in PHP con phpspec
TDD BDD PHP - Sviluppo guidato dai test in PHP con phpspecPatrick Luca Fazzi
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecGiulio De Donato
 
PHP - Programming language war, does it matter
PHP - Programming language war, does it matterPHP - Programming language war, does it matter
PHP - Programming language war, does it matterMizno Kruge
 
Programming tools for developers
Programming tools for developersProgramming tools for developers
Programming tools for developersBBVA API Market
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP StackLorna Mitchell
 
Get Codeigniter Developement Services From Us
 Get Codeigniter Developement Services From Us Get Codeigniter Developement Services From Us
Get Codeigniter Developement Services From UsJoe_Mason
 
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!Frédéric Harper
 

Similar a XDebug For php debugging (20)

PHP: Debugger, Profiler and more
PHP: Debugger, Profiler and morePHP: Debugger, Profiler and more
PHP: Debugger, Profiler and more
 
7 Top PHP Development Tools For PHP Coding
7 Top PHP Development Tools For PHP Coding7 Top PHP Development Tools For PHP Coding
7 Top PHP Development Tools For PHP Coding
 
How to really obfuscate your pdf malware
How to really obfuscate   your pdf malwareHow to really obfuscate   your pdf malware
How to really obfuscate your pdf malware
 
How to really obfuscate your pdf malware
How to really obfuscate your pdf malwareHow to really obfuscate your pdf malware
How to really obfuscate your pdf malware
 
Php code profiling_using_x_debug
Php code profiling_using_x_debugPhp code profiling_using_x_debug
Php code profiling_using_x_debug
 
PhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 PluginPhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 Plugin
 
How to write good quality code
How to write good quality codeHow to write good quality code
How to write good quality code
 
Learn to build a CodeIgniter Login and Registration with source code.pdf
Learn to build a CodeIgniter Login and Registration with source code.pdfLearn to build a CodeIgniter Login and Registration with source code.pdf
Learn to build a CodeIgniter Login and Registration with source code.pdf
 
Continuous feature-development
Continuous feature-developmentContinuous feature-development
Continuous feature-development
 
Xdebug
XdebugXdebug
Xdebug
 
Php Code Profiling Using X Debug
Php Code Profiling Using X DebugPhp Code Profiling Using X Debug
Php Code Profiling Using X Debug
 
Coscup
CoscupCoscup
Coscup
 
TDD BDD PHP - Sviluppo guidato dai test in PHP con phpspec
TDD BDD PHP - Sviluppo guidato dai test in PHP con phpspecTDD BDD PHP - Sviluppo guidato dai test in PHP con phpspec
TDD BDD PHP - Sviluppo guidato dai test in PHP con phpspec
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspec
 
PHP - Programming language war, does it matter
PHP - Programming language war, does it matterPHP - Programming language war, does it matter
PHP - Programming language war, does it matter
 
Programming tools for developers
Programming tools for developersProgramming tools for developers
Programming tools for developers
 
Tool up your lamp stack
Tool up your lamp stackTool up your lamp stack
Tool up your lamp stack
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP Stack
 
Get Codeigniter Developement Services From Us
 Get Codeigniter Developement Services From Us Get Codeigniter Developement Services From Us
Get Codeigniter Developement Services From Us
 
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
 

Último

Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 

Último (20)

Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 

XDebug For php debugging

  • 1. Debugging PHP with Xdebug Be Professional debugger with xdebug Omid Khosrojerdi omidkh68@gmail.com 1
  • 2. Debugging PHP with XDebug Omid Khosrojerdi omidkh68@gmail.com 1. Why Debugging ? 2. Debug tools 3. XDebug • What is XDebug ? • XDebug Enable [php.ini] • How to Install XDebug • How to use XDebug • XDebug remote connect • XDebug with phpStorm • XDebug browser extension • XDebug in IDEs 2
  • 3. Debugging PHP with XDebug - Debug tools Omid Khosrojerdi omidkh68@gmail.com • Var_dump() • Print_r() • echo • Xdump • Kint • Pinba • XDebug • IDEs • .... 3
  • 4. Debugging PHP with XDebug – What is XDebug ? Omid Khosrojerdi omidkh68@gmail.com What is XDebug ? With dbgp protocol 4
  • 5. Debugging PHP with XDebug - XDebug features Omid Khosrojerdi omidkh68@gmail.com By Function : xdebug_start_trace(); xdebug_stop_trace(); Automatically (php.ini) : xdebug.auto_trace = “1” Note : Can’t Using ini_set(); 5
  • 6. Debugging PHP with XDebug – XDebug Enable [php.ini] Omid Khosrojerdi omidkh68@gmail.com • xdebug.default_enable=1 • xdebug.coverage_enable=1 • xdebug.profiler_enable = 1 • xdebug.remote_handler = dbgp • Linux – Mac osx : xdebug.profiler_output_dir = "/tmp“ • Windows : xdebug.profiler_output_dir = “C:wamptmp“ • xdebug.remote_enable=1 • xdebug.remote_host=localhost • xdebug.remote_port=9000 • xdebug.remote_autostart=1 • xdebug.show_local_vars=1 • xdebug.show_local_vars=On • xdebug.collect_params=4 • xdebug.show_exception_trace=On 6
  • 7. Debugging PHP with XDebug - How to Install XDebug ? Omid Khosrojerdi omidkh68@gmail.com Installing with PEAR/PECL for unix/linux: # pecl install xdebug Installing From Source : git clone git://github.com/xdebug/xdebug.git Wamp OR Xampp OR Mamp Server : Installed Built-in 7
  • 8. Debugging PHP with XDebug - How to use XDebug ? Omid Khosrojerdi omidkh68@gmail.com Example: return execute duration time <?php echo xdebug_time_index(), "n"; for ($i = 0; $i < 250000; $i++) { // do nothing } echo xdebug_time_index(), "n"; ?> Returns: 0.00038003921508789 0.76580691337585 8 NOTE : ini_set('display_errors', ‘On');
  • 9. Debugging PHP with XDebug – XDebug remote Connect Omid Khosrojerdi omidkh68@gmail.com 9
  • 10. Debugging PHP with XDebug - XDebug browser extension Omid Khosrojerdi omidkh68@gmail.com Chrome Extension FirefoxAddons 10 https://addons.mozilla.org/en-US/firefox/addon/easy-xdebug/ https://chrome.google.com/webstore/detail/xdebug- helper/eadndfjplgieldjbigjakmdgkmoaaaoc
  • 11. Debugging PHP with XDebug - XDebug in IDEs Omid Khosrojerdi omidkh68@gmail.com phpStorm : https://www.jetbrains.com/phpstorm/webhelp/configuring-xdebug.html Zend studio : http://files.zend.com/help/Zend-Studio/content/installing_xdebug.htm NetBeans : https://netbeans.org/kb/docs/php/debugging.html 11
  • 12. Debugging PHP with XDebug - References Omid Khosrojerdi omidkh68@gmail.com http://xdebug.org/ http://coding.smashingmagazine.com/2009/01/20/50-extremely-useful-php-tools/ https://www.jetbrains.com/phpstorm/webhelp/configuring-xdebug.html http://files.zend.com/help/Zend-Studio/content/installing_xdebug.htm http://devzone.zend.com/1120/introducing-xdebug/ 12
  • 13. Debugging PHP with XDebug - Question Omid Khosrojerdi omidkh68@gmail.com Question? 13