Know what your app is thinking... magically
with XDebug
Kalen Johnson
- Web Developer
- PHP, Front-end, WordPress
- Self-employed crazy person
http://kalenjohnson.com
@kalenjohnson
Son: Nate
as developers
We spend a lot of time reading code
We spend a lot of time understanding code
We spend a lot of time cursing code
why make it more difficult?
is this familiar?
why?
so put it in pre tags, problem solved!
not quite
better
But not by much
what to do?
xdebug
- Interactive Debugger
- Profiler
- Enhanced var_dump
- Stack Traces on Error Conditions
- Maximum Nesting Level Protection
- http://xdebug.org/
hardcore logo
Installing
apt-get install php5-xdebug
Ubuntu & co.
CentOS, Fedora, RHEL, etc.
yum install php-pecl-xdebug.x86_64
Mac OSX using Homebrew
brew tap josegonzalez/homebrew-php
brew install php55-xdebug
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
php.ini
xdebug.ini
my suggestion: Use Vagrant
Double
Check
phpinfo();
congragulations
We've installed a PHP Module
Text
This becomes
wow, readable!
errors
becomes
pretty stack trace
When does
this get good?
RIGHT NOW!
Or right after a quick intro to what an interactive debugger is:
- Ability to start and stop PHP while it is running
- Set breakpoints in code
- Step in, step out, step over
get ready for the
(queue interactive demo)
profiling
XDebug profiling & PHPStorm:
Webgrind:
https://github.com/jokkedk/webgrind
Other (newer) Profilers:
Blackfire: https://blackfire.io/
New Relic: http://www.newrelic.com/PHP-Profiling
Thank you!
Questions?
Know what your app is thinking magically, with Xdebug
By Kalen Johnson
Know what your app is thinking magically, with Xdebug
- 4,443