SlideShare uma empresa Scribd logo
1 de 23
Baixar para ler offline
Debugging and Profiling
PHP Applications
Logan Lindquist
@llbbl
Debugging vs Profiling
Debugging
Bug fixing
Used during Development to minimize bugs
Profiling
Performance tuning
?????
What Is This Magic?!?
Xdebug is AWESOME
Pretty var_dumps
Enhanced

Stack Trace
Debugging
Profiling
OMGWTFBBQ Install it NOW
OSX:
Install homebrew
Follow instructions: https://github.com/Homebrew/homebrew-
php#installation
brew install php54-xdebug
Ubuntu:
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
php5-xdebug
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Windows: Install Vagrant then follow Ubuntu
Configure Xdebug for
Debugging
Turn on remote debugging:
xdebug.remote_enable=1
Configure what port, host, log file ... and more
xdebug.remote_port= 9000
xdebug.remote_log="/var/www/xdebug.log"
xdebug.remote_host="localhost"
Xdebug Profiling
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "/var/www/xdebug"
xdebug.profiler_output_name = xdebug.out.%t
Make sure you have the right PHP
Settings > PHP > Intrepreters
....you should see xdebug
Here is how to check symlinked or not
Tools > Deployment > Configuration
Gotchas
• Make sure profile directory exists and is writeable by
the web server
• Nothing works without xdebug.remote_enable=1
• Make sure port number matches in your ini and
phpstorm. Both default 9000
• SOOOOO many steps ... No shutup, stop being lazy
and just do it
How to trigger a debug session
• Javascript bookmarklets
• Chrome extension
• Within PhpStorm
• Magic
• Production crashes
Let's cover the first three
shall we?
Jetbrains Has The Goodies
http://www.jetbrains.com/phpstorm/marklets/
• Start Debugger:
• Goto page
• Hit Start Debugger
• Hit Stop Debugger when done debugging
• Debug this page:
• Goto page
• Hit Debug this page
Chrome Extension
Name: Xdebug Helper
https://chrome.google.com/webstore/detail/xdebug-
helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en
PhpStorm
PhpStorm + Xdebug
Profiling with PhpStorm
Tools > Analyze Xdebug Profiler Snapshot
MCG https://itunes.apple.com/us/app/mcg/id799178412?mt=12
Profiling with MCG
XHProf
XHProf
XHProf
• Built by Facebook opensourced in 2009
• Xdebug not required
• Way more complicated to setup
• Documentation isn't great
• Requires you to add xhprof methods to your code
• Requires you to configure apache vhost for reporting
• Has callgraph charts (directed graphs) and a couple other nice features
Install isn't too bad with
homebrew or apt-get
In Review...
• Installed Xdebug
• Setup Xdebug with PhpStorm
• Configured Xdebug for profiling or debugging

Mais conteúdo relacionado

Mais procurados

Linux directory structure by jitu mistry
Linux directory structure by jitu mistryLinux directory structure by jitu mistry
Linux directory structure by jitu mistryJITU MISTRY
 
Usage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxUsage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxWilliam Lee
 
Playing Video with ExoPlayer : Android Bangkok 2018
Playing Video with ExoPlayer : Android Bangkok 2018Playing Video with ExoPlayer : Android Bangkok 2018
Playing Video with ExoPlayer : Android Bangkok 2018Minseo Chayabanjonglerd
 
eBPF in the view of a storage developer
eBPF in the view of a storage developereBPF in the view of a storage developer
eBPF in the view of a storage developerRichárd Kovács
 
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSBuilding a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSFernando Luiz Cola
 
왕초보를 위한 도커 사용법
왕초보를 위한 도커 사용법왕초보를 위한 도커 사용법
왕초보를 위한 도커 사용법GeunCheolYeom
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingTushar B Kute
 
초심자를 위한 도커 소개 및 입문
초심자를 위한 도커 소개 및 입문초심자를 위한 도커 소개 및 입문
초심자를 위한 도커 소개 및 입문Daniel Seo
 
Linux Directory Structure
Linux Directory StructureLinux Directory Structure
Linux Directory StructureKevin OBrien
 
Client server computing_keypoint_and_questions
Client server computing_keypoint_and_questionsClient server computing_keypoint_and_questions
Client server computing_keypoint_and_questionslucky94527
 
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운다운 정
 
우리가 몰랐던 크롬 개발자 도구
우리가 몰랐던 크롬 개발자 도구우리가 몰랐던 크롬 개발자 도구
우리가 몰랐던 크롬 개발자 도구Jae Sung Park
 
From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'Matt Warren
 
Easiest way to start with Shell scripting
Easiest way to start with Shell scriptingEasiest way to start with Shell scripting
Easiest way to start with Shell scriptingAkshay Siwal
 
Oracle Form Graphics
Oracle Form GraphicsOracle Form Graphics
Oracle Form GraphicsAmer Rafiq
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scriptingvceder
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedureDhaval Kaneria
 

Mais procurados (20)

Linux directory structure by jitu mistry
Linux directory structure by jitu mistryLinux directory structure by jitu mistry
Linux directory structure by jitu mistry
 
RPM (LINUX)
RPM (LINUX)RPM (LINUX)
RPM (LINUX)
 
Usage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxUsage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on Linux
 
Playing Video with ExoPlayer : Android Bangkok 2018
Playing Video with ExoPlayer : Android Bangkok 2018Playing Video with ExoPlayer : Android Bangkok 2018
Playing Video with ExoPlayer : Android Bangkok 2018
 
eBPF in the view of a storage developer
eBPF in the view of a storage developereBPF in the view of a storage developer
eBPF in the view of a storage developer
 
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSBuilding a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
 
왕초보를 위한 도커 사용법
왕초보를 위한 도커 사용법왕초보를 위한 도커 사용법
왕초보를 위한 도커 사용법
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
초심자를 위한 도커 소개 및 입문
초심자를 위한 도커 소개 및 입문초심자를 위한 도커 소개 및 입문
초심자를 위한 도커 소개 및 입문
 
Linux Directory Structure
Linux Directory StructureLinux Directory Structure
Linux Directory Structure
 
Client server computing_keypoint_and_questions
Client server computing_keypoint_and_questionsClient server computing_keypoint_and_questions
Client server computing_keypoint_and_questions
 
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운
 
우리가 몰랐던 크롬 개발자 도구
우리가 몰랐던 크롬 개발자 도구우리가 몰랐던 크롬 개발자 도구
우리가 몰랐던 크롬 개발자 도구
 
From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'From 'dotnet run' to 'hello world'
From 'dotnet run' to 'hello world'
 
OSGi Blueprint Services
OSGi Blueprint ServicesOSGi Blueprint Services
OSGi Blueprint Services
 
Easiest way to start with Shell scripting
Easiest way to start with Shell scriptingEasiest way to start with Shell scripting
Easiest way to start with Shell scripting
 
Oracle Form Graphics
Oracle Form GraphicsOracle Form Graphics
Oracle Form Graphics
 
Linux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platformLinux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platform
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedure
 

Destaque

Profiling PHP - AmsterdamPHP Meetup - 2014-11-20
Profiling PHP - AmsterdamPHP Meetup - 2014-11-20Profiling PHP - AmsterdamPHP Meetup - 2014-11-20
Profiling PHP - AmsterdamPHP Meetup - 2014-11-20Dennis de Greef
 
From Meme To Social Fabric
From Meme To Social FabricFrom Meme To Social Fabric
From Meme To Social FabricIsaac Mao
 
Artificial Vision Using System No Blinds In The World
Artificial Vision Using System No Blinds In The WorldArtificial Vision Using System No Blinds In The World
Artificial Vision Using System No Blinds In The WorldR.PRABHU R.RAJENDRAN
 
Rice puller pdf home page ready to paste
Rice puller pdf home page ready to pasteRice puller pdf home page ready to paste
Rice puller pdf home page ready to pasteRice Puller
 
RICE PULLER NAHI HOTA HE 09425636422 + 09981011455 CLICK HERE FOR DETAIL ...
RICE PULLER NAHI HOTA HE 09425636422 + 09981011455 CLICK HERE FOR DETAIL     ...RICE PULLER NAHI HOTA HE 09425636422 + 09981011455 CLICK HERE FOR DETAIL     ...
RICE PULLER NAHI HOTA HE 09425636422 + 09981011455 CLICK HERE FOR DETAIL ...Rice Puller
 
Iridium.Ppt [Recovered]
Iridium.Ppt [Recovered]Iridium.Ppt [Recovered]
Iridium.Ppt [Recovered]hem
 
Basic overview of an artificial eye
Basic overview of an artificial eyeBasic overview of an artificial eye
Basic overview of an artificial eyeTabish Ansar
 
Report of PILL CAMERA
Report of PILL CAMERAReport of PILL CAMERA
Report of PILL CAMERArazaemohammed
 
10 myths about psychology
10 myths about psychology10 myths about psychology
10 myths about psychologyTED Talks
 
I'm a smartphone addict
I'm a smartphone addictI'm a smartphone addict
I'm a smartphone addictLior Frenkel
 
12 Time Management Techniques
12 Time Management Techniques12 Time Management Techniques
12 Time Management TechniquesWeekdone.com
 
Hacking & its types
Hacking & its typesHacking & its types
Hacking & its typesSai Sakoji
 
Can We Assess Creativity?
Can We Assess Creativity?Can We Assess Creativity?
Can We Assess Creativity?John Spencer
 

Destaque (19)

Profiling PHP - AmsterdamPHP Meetup - 2014-11-20
Profiling PHP - AmsterdamPHP Meetup - 2014-11-20Profiling PHP - AmsterdamPHP Meetup - 2014-11-20
Profiling PHP - AmsterdamPHP Meetup - 2014-11-20
 
Torrents
TorrentsTorrents
Torrents
 
From Meme To Social Fabric
From Meme To Social FabricFrom Meme To Social Fabric
From Meme To Social Fabric
 
Iridium
IridiumIridium
Iridium
 
Artificial Vision Using System No Blinds In The World
Artificial Vision Using System No Blinds In The WorldArtificial Vision Using System No Blinds In The World
Artificial Vision Using System No Blinds In The World
 
Rice puller pdf home page ready to paste
Rice puller pdf home page ready to pasteRice puller pdf home page ready to paste
Rice puller pdf home page ready to paste
 
RICE PULLER NAHI HOTA HE 09425636422 + 09981011455 CLICK HERE FOR DETAIL ...
RICE PULLER NAHI HOTA HE 09425636422 + 09981011455 CLICK HERE FOR DETAIL     ...RICE PULLER NAHI HOTA HE 09425636422 + 09981011455 CLICK HERE FOR DETAIL     ...
RICE PULLER NAHI HOTA HE 09425636422 + 09981011455 CLICK HERE FOR DETAIL ...
 
Iridium.Ppt [Recovered]
Iridium.Ppt [Recovered]Iridium.Ppt [Recovered]
Iridium.Ppt [Recovered]
 
Basic overview of an artificial eye
Basic overview of an artificial eyeBasic overview of an artificial eye
Basic overview of an artificial eye
 
Artificial eye
Artificial eyeArtificial eye
Artificial eye
 
Pill camera ppt
Pill camera pptPill camera ppt
Pill camera ppt
 
artificial eye
artificial eyeartificial eye
artificial eye
 
Report of PILL CAMERA
Report of PILL CAMERAReport of PILL CAMERA
Report of PILL CAMERA
 
10 myths about psychology
10 myths about psychology10 myths about psychology
10 myths about psychology
 
I'm a smartphone addict
I'm a smartphone addictI'm a smartphone addict
I'm a smartphone addict
 
Iridium satellite system
Iridium satellite systemIridium satellite system
Iridium satellite system
 
12 Time Management Techniques
12 Time Management Techniques12 Time Management Techniques
12 Time Management Techniques
 
Hacking & its types
Hacking & its typesHacking & its types
Hacking & its types
 
Can We Assess Creativity?
Can We Assess Creativity?Can We Assess Creativity?
Can We Assess Creativity?
 

Semelhante a Debugging and Profiling PHP Applications

Debugging PHP with xDebug inside of Eclipse PDT 2.1
Debugging PHP with xDebug inside of Eclipse PDT 2.1Debugging PHP with xDebug inside of Eclipse PDT 2.1
Debugging PHP with xDebug inside of Eclipse PDT 2.1Bastian Feder
 
Debugging Drupal with Xdebug
Debugging Drupal with XdebugDebugging Drupal with Xdebug
Debugging Drupal with XdebugFrank Carey
 
Setting advanced PHP development environment
Setting advanced PHP development environmentSetting advanced PHP development environment
Setting advanced PHP development environmentKapil Sharma
 
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneWhen Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneDavid Glick
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer ToolboxPablo Godel
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Fabrice Bernhard
 
DDD (Debugger Driven Development)
DDD (Debugger Driven Development)DDD (Debugger Driven Development)
DDD (Debugger Driven Development)Carlos Granados
 
Improving WordPress Performance: Xdebug and PHP profiling
Improving WordPress Performance: Xdebug and PHP profilingImproving WordPress Performance: Xdebug and PHP profiling
Improving WordPress Performance: Xdebug and PHP profilingSeravo
 
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)Francisco José Seva Mora
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionJoe Ferguson
 
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudSalesforce Developers
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionJoe Ferguson
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confooCombell NV
 
Fluentd and PHP
Fluentd and PHPFluentd and PHP
Fluentd and PHPchobi e
 
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
 
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 phpbnl11Combell NV
 
Madison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small TeamsMadison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small TeamsJoe Ferguson
 
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsJoe Ferguson
 

Semelhante a Debugging and Profiling PHP Applications (20)

Debugging PHP with xDebug inside of Eclipse PDT 2.1
Debugging PHP with xDebug inside of Eclipse PDT 2.1Debugging PHP with xDebug inside of Eclipse PDT 2.1
Debugging PHP with xDebug inside of Eclipse PDT 2.1
 
Debugging Drupal with Xdebug
Debugging Drupal with XdebugDebugging Drupal with Xdebug
Debugging Drupal with Xdebug
 
Setting advanced PHP development environment
Setting advanced PHP development environmentSetting advanced PHP development environment
Setting advanced PHP development environment
 
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneWhen Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
DDD (Debugger Driven Development)
DDD (Debugger Driven Development)DDD (Debugger Driven Development)
DDD (Debugger Driven Development)
 
Improving WordPress Performance: Xdebug and PHP profiling
Improving WordPress Performance: Xdebug and PHP profilingImproving WordPress Performance: Xdebug and PHP profiling
Improving WordPress Performance: Xdebug and PHP profiling
 
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
 
Xdebug from a to x
Xdebug from a to xXdebug from a to x
Xdebug from a to x
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
 
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the Cloud
 
Xdebug
XdebugXdebug
Xdebug
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confoo
 
Fluentd and PHP
Fluentd and PHPFluentd and PHP
Fluentd and PHP
 
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)
 
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
 
Madison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small TeamsMadison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small Teams
 
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small Teams
 

Último

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Último (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Debugging and Profiling PHP Applications

  • 1. Debugging and Profiling PHP Applications Logan Lindquist @llbbl
  • 2. Debugging vs Profiling Debugging Bug fixing Used during Development to minimize bugs Profiling Performance tuning
  • 4. What Is This Magic?!?
  • 5. Xdebug is AWESOME Pretty var_dumps Enhanced
 Stack Trace Debugging Profiling
  • 6. OMGWTFBBQ Install it NOW OSX: Install homebrew Follow instructions: https://github.com/Homebrew/homebrew- php#installation brew install php54-xdebug Ubuntu: sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-xdebug ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" Windows: Install Vagrant then follow Ubuntu
  • 7. Configure Xdebug for Debugging Turn on remote debugging: xdebug.remote_enable=1 Configure what port, host, log file ... and more xdebug.remote_port= 9000 xdebug.remote_log="/var/www/xdebug.log" xdebug.remote_host="localhost"
  • 8. Xdebug Profiling xdebug.profiler_enable = 1 xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = "/var/www/xdebug" xdebug.profiler_output_name = xdebug.out.%t
  • 9. Make sure you have the right PHP Settings > PHP > Intrepreters ....you should see xdebug
  • 10. Here is how to check symlinked or not Tools > Deployment > Configuration
  • 11. Gotchas • Make sure profile directory exists and is writeable by the web server • Nothing works without xdebug.remote_enable=1 • Make sure port number matches in your ini and phpstorm. Both default 9000 • SOOOOO many steps ... No shutup, stop being lazy and just do it
  • 12. How to trigger a debug session • Javascript bookmarklets • Chrome extension • Within PhpStorm • Magic • Production crashes Let's cover the first three shall we?
  • 13. Jetbrains Has The Goodies http://www.jetbrains.com/phpstorm/marklets/ • Start Debugger: • Goto page • Hit Start Debugger • Hit Stop Debugger when done debugging • Debug this page: • Goto page • Hit Debug this page
  • 14. Chrome Extension Name: Xdebug Helper https://chrome.google.com/webstore/detail/xdebug- helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en
  • 17. Profiling with PhpStorm Tools > Analyze Xdebug Profiler Snapshot
  • 22. XHProf • Built by Facebook opensourced in 2009 • Xdebug not required • Way more complicated to setup • Documentation isn't great • Requires you to add xhprof methods to your code • Requires you to configure apache vhost for reporting • Has callgraph charts (directed graphs) and a couple other nice features Install isn't too bad with homebrew or apt-get
  • 23. In Review... • Installed Xdebug • Setup Xdebug with PhpStorm • Configured Xdebug for profiling or debugging