Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Xdebug / debugging PHP applications (WebElement...
Search
Vladimír Kriška
December 08, 2011
Programming
300
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Xdebug / debugging PHP applications (WebElement #2)
Vladimír Kriška
December 08, 2011
More Decks by Vladimír Kriška
See All by Vladimír Kriška
Twelve-Factor app with Docker
ujovlado
0
180
Design a REST API you will love to work with
ujovlado
0
810
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
530
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
440
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
200
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
150
CSS Flexbox (WebElement #35)
ujovlado
0
200
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
210
Don't underestimate CSS (WebElement #30)
ujovlado
0
650
Other Decks in Programming
See All in Programming
引き算の組織 ― アウトカムとAIに全振りするために辞めたこと ― / Organization by Subtraction
hirokiyamamoto14
PRO
0
280
リアルな遅延を測る仕様
kota_yata
1
120
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
510
Dockerfile CMD for Node.js
grazie1999
0
110
Built Our Own Background Agent at LayerX
layerx
PRO
10
6k
Building a Meta Ray-Ban display app
akkeylab
0
170
typoなんかねぇよ
raspython3
0
400
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
350
ソフトウェアエンジニアにとっての生成AI - 特性を知って使い倒す / generative ai for software enginner
kishida
7
2.1k
Go 1.27 における memory allocation の高速化
andpad
0
300
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.4k
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
140
Featured
See All Featured
Writing Fast Ruby
sferik
630
63k
Visualization
eitanlees
152
17k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Embracing the Ebb and Flow
colly
88
5.1k
Mind Mapping
helmedeiros
PRO
1
330
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
We Have a Design System, Now What?
morganepeng
55
8.3k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
390
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
520
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
380
Transcript
Xdebug debugging PHP applications WebElement event #2, 08.12.2011 Vladimír Kriška,
@ujovlado
“I Don't Need A Debugger” • Chuck Norris doesn't •
for everyone else is Xdebug These functions are insufficient: • echo • print_r() • var_dump() … or your's framework built-in functions And you probably use them with <pre> tag.
Xdebug • Open Source debugging tool https://github.com/derickr/xdebug • Easy to
configure • Easy to use • Works on every platform • Nice, colored output
Initial configuration • html_errors = On • zend_extension=/path/to/xdebug.so e.g.: /usr/lib/php5/20090626/xdebug.so
Let's start How much to show: • xdebug.var_display_max_children (128) •
xdebug.var_display_max_data (512) • xdebug.var_display_max_depth (3) Xdebug overloads var_dump() by default.
Example code
Output
Stack trace - code
Stack trace - output
Function trace - code
Function trace - output file
Code coverage Detect which lines of script was executed. Three
functions: • xdebug_start_code_coverage() • xdebug_stop_code_coverage() • xdebug_get_code_coverage()
Code coverage - code
Code coverage - output
Tracefile analyser Set xdebug.trace_format=1 tracefile-analyser.php tracefile.xt [sortkey] [elements] Available sortkeys:
• calls • time-inclusive • memory-inclusive • time-own • memory-own
None
Profiling Set: xdebug.profiler_enable=1 xdebug.profiler_output_dir=/var/www/xdebug/tmp Generates cachegrind file. Tools: • KCachegrind
• Webgrind
Debugging xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000
“Scream” mode xdebug.scream=1 Set this to disable the “@” operator.
All errors, warnings and notices will be visible.
Some new features in 2.2 xdebug.cli_color - colored output in
CLI mode xdebug.coverage_enable - if you turn this off, it speeds up Xdebug, but coverage analysis won't work
Resources Xdebug home page - http://xdebug.org/ Derick Rethans - http://derickrethans.nl/
Thank you! Any questions?