Slide 1

Slide 1 text

Power  Debugging  &  Profiling   Your  PHP  Apps   Abu  Ashraf  Masnun  

Slide 2

Slide 2 text

WHAT’S  YOUR  STORY?   Let’s  share  experiences!  

Slide 3

Slide 3 text

Error  Display   •  Turn  on  error  display     •  Report  all  errors   •  E_ALL  |  E_STRICT   •  Don’t  ignore  those  “NoKce”  messages  

Slide 4

Slide 4 text

Print  &  Die   •  Output  something  and  then  terminate  the   script.     •  var_dump()     •  print_r()   •  Output  buffering  for  cleaner  output   •  debug_backtrace()  

Slide 5

Slide 5 text

Logging   •  Use  a  logging  library  (Monolog,  anyone?)   •  error_log()   •  mod_php  sets  stderr  to  apache  logs:   –  file_put_contents('php://stderr',  print_r($foo,  TRUE))   •  trigger_error()  &  set_error_handler()   Tail  your  logs:     tail  -­‐f  your_log_file_path  

Slide 6

Slide 6 text

InteresKng  Tools   •  FirePHP,  Chrome  Logger   •  Kint,  PHP  Debug  Bar  

Slide 7

Slide 7 text

THE  MOTHER  OF  ALL  DEBUGGER   Let’s  meet    

Slide 8

Slide 8 text

ConfiguraKon  

Slide 9

Slide 9 text

Netbeans  

Slide 10

Slide 10 text

Netbeans  

Slide 11

Slide 11 text

Netbeans  

Slide 12

Slide 12 text

PROFILING  LIKE  A  PRO  

Slide 13

Slide 13 text

Start  Profiling  

Slide 14

Slide 14 text

The  Cachegrind  Files  

Slide 15

Slide 15 text

Using  Webgrind  

Slide 16

Slide 16 text

@MASNUN   Feel  free  to  reach  out:     hap://masnun.me