13
(Php)Storming WordPress A remote debugging experience

WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

(Php)Storming WordPress A remote debugging experience

Page 2: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

Introduction/ Andrea Fuggetta

/ Senior software engineer at Ndevr, Inc. - https://ndevr.io/

/ Some of the projects I worked on:

Page 3: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

About Us/ Since 2015

/ Distributed

/ 50% Located in NY/NJ Metro

/ Average experience over 15 years

Page 4: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

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

Page 5: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

Tools and software/ PhpStorm/ Google Chrome w/ Xdebug helper/ Terminal/ Vagrant/ Xdebug/ PHPUnit/ WP-CLI

Page 6: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

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”

Page 7: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

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

Page 8: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

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

Page 9: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

Setting up PhpStorm/ Zero-configuration debugging/ Create a new remote debug configuration/ Important things to remember:

/ Host/ Port / Path Mapping / Session ID

/ Hands on!

Page 10: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

Setting up your terminal/ Your terminal needs to send out the session ID

/ Hands on!

Page 11: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

Let’s code!/ WordPress theme/ WP-CLI application/ PHPUnit test

Page 12: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

References/ https://wordpress.org/ https://xdebug.org/ https://www.jetbrains.com/ https://phpunit.de/ http://wp-cli.org/ https://ndevr.io

Page 13: WordCamp Cincinnati - A remote debugging …...Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current

Thank You!Andrea Fuggetta/ Email: [email protected]/ 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