SlideShare a Scribd company logo
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
Ad

More Related Content

What's hot (9)

PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...
PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...
PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...
Tatsuya Watanabe
 
大規模DCのネットワークデザイン
大規模DCのネットワークデザイン大規模DCのネットワークデザイン
大規模DCのネットワークデザイン
Masayuki Kobayashi
 
TUI作業で便利なソフト2題
TUI作業で便利なソフト2題TUI作業で便利なソフト2題
TUI作業で便利なソフト2題
shimadah
 
Introduction to CNI (Container Network Interface)
Introduction to CNI (Container Network Interface)Introduction to CNI (Container Network Interface)
Introduction to CNI (Container Network Interface)
HungWei Chiu
 
Continuous Testing with Molecule, Ansible, and GitHub Actions
Continuous Testing with Molecule, Ansible, and GitHub ActionsContinuous Testing with Molecule, Ansible, and GitHub Actions
Continuous Testing with Molecule, Ansible, and GitHub Actions
Jeff Geerling
 
Advanced RF Design & Troubleshooting
Advanced RF Design & TroubleshootingAdvanced RF Design & Troubleshooting
Advanced RF Design & Troubleshooting
Aruba, a Hewlett Packard Enterprise company
 
Linux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network SecurityLinux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network Security
Thomas Graf
 
コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線
Motonori Shindo
 
Cilium - Network security for microservices
Cilium - Network security for microservicesCilium - Network security for microservices
Cilium - Network security for microservices
Thomas Graf
 
PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...
PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...
PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...
Tatsuya Watanabe
 
大規模DCのネットワークデザイン
大規模DCのネットワークデザイン大規模DCのネットワークデザイン
大規模DCのネットワークデザイン
Masayuki Kobayashi
 
TUI作業で便利なソフト2題
TUI作業で便利なソフト2題TUI作業で便利なソフト2題
TUI作業で便利なソフト2題
shimadah
 
Introduction to CNI (Container Network Interface)
Introduction to CNI (Container Network Interface)Introduction to CNI (Container Network Interface)
Introduction to CNI (Container Network Interface)
HungWei Chiu
 
Continuous Testing with Molecule, Ansible, and GitHub Actions
Continuous Testing with Molecule, Ansible, and GitHub ActionsContinuous Testing with Molecule, Ansible, and GitHub Actions
Continuous Testing with Molecule, Ansible, and GitHub Actions
Jeff Geerling
 
Linux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network SecurityLinux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network Security
Thomas Graf
 
コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線
Motonori Shindo
 
Cilium - Network security for microservices
Cilium - Network security for microservicesCilium - Network security for microservices
Cilium - Network security for microservices
Thomas Graf
 

Viewers also liked (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
Dennis de Greef
 
Torrents
TorrentsTorrents
Torrents
Ahmad0Muhammad
 
From Meme To Social Fabric
From Meme To Social FabricFrom Meme To Social Fabric
From Meme To Social Fabric
Isaac Mao
 
Iridium
IridiumIridium
Iridium
shamyla7
 
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
R.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 paste
Rice 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 eye
Tabish Ansar
 
Artificial eye
Artificial eyeArtificial eye
Artificial eye
Rakesh Mairembam
 
Pill camera ppt
Pill camera pptPill camera ppt
Pill camera ppt
sudheer sandy
 
artificial eye
artificial eyeartificial eye
artificial eye
Rajeshwari Raji
 
Report of PILL CAMERA
Report of PILL CAMERAReport of PILL CAMERA
Report of PILL CAMERA
razaemohammed
 
10 myths about psychology
10 myths about psychology10 myths about psychology
10 myths about psychology
TED Talks
 
I'm a smartphone addict
I'm a smartphone addictI'm a smartphone addict
I'm a smartphone addict
Lior Frenkel
 
Iridium satellite system
Iridium satellite systemIridium satellite system
Iridium satellite system
PRADEEP Cheekatla
 
12 Time Management Techniques
12 Time Management Techniques12 Time Management Techniques
12 Time Management Techniques
Weekdone.com
 
Hacking & its types
Hacking & its typesHacking & its types
Hacking & its types
Sai Sakoji
 
Can We Assess Creativity?
Can We Assess Creativity?Can We Assess Creativity?
Can We Assess Creativity?
John Spencer
 
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
Dennis de Greef
 
From Meme To Social Fabric
From Meme To Social FabricFrom Meme To Social Fabric
From Meme To Social Fabric
Isaac 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 World
R.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 paste
Rice 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 eye
Tabish Ansar
 
Report of PILL CAMERA
Report of PILL CAMERAReport of PILL CAMERA
Report of PILL CAMERA
razaemohammed
 
10 myths about psychology
10 myths about psychology10 myths about psychology
10 myths about psychology
TED Talks
 
I'm a smartphone addict
I'm a smartphone addictI'm a smartphone addict
I'm a smartphone addict
Lior Frenkel
 
12 Time Management Techniques
12 Time Management Techniques12 Time Management Techniques
12 Time Management Techniques
Weekdone.com
 
Hacking & its types
Hacking & its typesHacking & its types
Hacking & its types
Sai Sakoji
 
Can We Assess Creativity?
Can We Assess Creativity?Can We Assess Creativity?
Can We Assess Creativity?
John Spencer
 
Ad

Similar to 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
Bastian Feder
 
Debugging Drupal with Xdebug
Debugging Drupal with XdebugDebugging Drupal with Xdebug
Debugging Drupal with Xdebug
Frank Carey
 
Setting advanced PHP development environment
Setting advanced PHP development environmentSetting advanced PHP development environment
Setting advanced PHP development environment
Kapil 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 Plone
David Glick
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
Pablo 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 profiling
Seravo
 
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
 
Introduction to Xdebug
Introduction to XdebugIntroduction to Xdebug
Introduction to Xdebug
Abid Malik
 
Xdebug from a to x
Xdebug from a to xXdebug from a to x
Xdebug from a to x
Gennady Feldman
 
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
Joe 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 Cloud
Salesforce Developers
 
Xdebug
XdebugXdebug
Xdebug
Bryce Embry
 
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
Joe 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 confoo
Combell NV
 
Fluentd and PHP
Fluentd and PHPFluentd and PHP
Fluentd and PHP
chobi 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 phpbnl11
Combell 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 Teams
Joe Ferguson
 
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
Bastian Feder
 
Debugging Drupal with Xdebug
Debugging Drupal with XdebugDebugging Drupal with Xdebug
Debugging Drupal with Xdebug
Frank Carey
 
Setting advanced PHP development environment
Setting advanced PHP development environmentSetting advanced PHP development environment
Setting advanced PHP development environment
Kapil 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 Plone
David Glick
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
Pablo 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 profiling
Seravo
 
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
 
Introduction to Xdebug
Introduction to XdebugIntroduction to Xdebug
Introduction to Xdebug
Abid Malik
 
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
Joe 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 Cloud
Salesforce 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 Production
Joe 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 confoo
Combell NV
 
Fluentd and PHP
Fluentd and PHPFluentd and PHP
Fluentd and PHP
chobi 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 phpbnl11
Combell 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 Teams
Joe Ferguson
 
Ad

Recently uploaded (20)

Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 

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