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

Windows

There are some .dll's here? Have fun

http://xdebug.org/download.php

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

Thank you!

Questions?

Know what your app is thinking magically, with Xdebug

By Kalen Johnson

Know what your app is thinking magically, with Xdebug

  • 2,928
Loading comments...

More from Kalen Johnson