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
290
0
Share
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
170
Design a REST API you will love to work with
ujovlado
0
800
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
520
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
420
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
180
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
130
CSS Flexbox (WebElement #35)
ujovlado
0
200
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
200
Don't underestimate CSS (WebElement #30)
ujovlado
0
640
Other Decks in Programming
See All in Programming
AIエージェントの隔離技術の徹底比較
kawayu
0
440
Swiftのレキシカルスコープ管理
kntkymt
0
200
次世代リンターで探る、tsgo 時代における型認識カスタムルールの現実解
ytakahashii
3
1.3k
初めてのRubyKaigiはこう見えた
jellyfish700
0
360
AIとRubyの静的型付け
ukin0k0
0
470
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.8k
AI駆動開発勉強会 広島支部 第一回勉強会 AI駆動開発概要とワークショップ
hayatoshimiu
0
410
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
130
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
1.3k
TypeScriptだけでAIエージェントを作る フロント・エージェント・インフラのフルスタック実践
har1101
6
1.2k
誰も頼んでない機能を出荷した話
zekutax
0
150
OSもどきOS
arkw
0
330
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
760
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
590
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
New Earth Scene 8
popppiees
3
2.3k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
210
Producing Creativity
orderedlist
PRO
348
40k
WCS-LA-2024
lcolladotor
0
610
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1.1k
Into the Great Unknown - MozCon
thekraken
41
2.5k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
220
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?