Post on 15-Oct-2020
(Php)Storming WordPress A remote debugging experience
Introduction/ Andrea Fuggetta
/ Senior software engineer at Ndevr, Inc. - https://ndevr.io/
/ Some of the projects I worked on:
About Us/ Since 2015
/ Distributed
/ 50% Located in NY/NJ Metro
/ Average experience over 15 years
Outline/ Tools and software/ Setting up Xdebug/ Setting up PhpStorm/ Setting up your terminal/ Let’s code! – Debugging case scenarios:
/ WordPress theme/ WP-CLI application/ PHPUnit test
/ References/ Q&A
Tools and software/ PhpStorm/ Google Chrome w/ Xdebug helper/ Terminal/ Vagrant/ Xdebug/ PHPUnit/ WP-CLI
Setting up Xdebug/ Info on https://xdebug.org/docs/install
/ Installation on Mac OSX via Homebrew:# brew install <php-version>-xdebug
/ Installation on Linux via apt-get:# sudo apt-get install <php-version>-xdebug
/ Php.ini:Add: zend_extension="/path-to/xdebug.so"
[Xdebug]
xdebug.remote_enable=1
xdebug.remote_port=“9000”
Debugging/ Breakpoint: line break where an application suspends execution allowing you to examine data/ Step-over: runs code in current line and moves to next code statement/ Step-into: moves into functions/methods if any are present in current line/ Step-out: runs current function/method and returns to previous execution point
Listens for connections
Setting up PhpStorm/ Enable external connections and set correct port
/ More info can be found at https://www.jetbrains.com/help/phpstorm/2016.2/configuring-xdebug.html
Setting up PhpStorm/ Zero-configuration debugging/ Create a new remote debug configuration/ Important things to remember:
/ Host/ Port / Path Mapping / Session ID
/ Hands on!
Setting up your terminal/ Your terminal needs to send out the session ID
/ Hands on!
Let’s code!/ WordPress theme/ WP-CLI application/ PHPUnit test
References/ https://wordpress.org/ https://xdebug.org/ https://www.jetbrains.com/ https://phpunit.de/ http://wp-cli.org/ https://ndevr.io
Thank You!Andrea Fuggetta/ Email: afuggetta@ndevr.io/ LinkedIn: https://www.linkedin.com/in/andreafuggetta/ GitHub: https://github.com/afuggetta
Q&A
/ LinkedIn: https://www.linkedin.com/company/ndevr / GitHub: https://github.com/ndevrinc/ Twitter: https://twitter.com/ndevrinc
/ Slides http://bit.ly/debugpstorm