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
0
260
Xdebug / debugging PHP applications (WebElement #2)
Vladimír Kriška
December 08, 2011
Tweet
Share
More Decks by Vladimír Kriška
See All by Vladimír Kriška
Twelve-Factor app with Docker
ujovlado
0
100
Design a REST API you will love to work with
ujovlado
0
740
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
470
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
370
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
130
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
82
CSS Flexbox (WebElement #35)
ujovlado
0
150
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
160
Don't underestimate CSS (WebElement #30)
ujovlado
0
580
Other Decks in Programming
See All in Programming
ドメインモデリングにおける抽象の役割、tagless-finalによるDSL構築、そして型安全な最適化
knih
11
2k
アンドパッドの Go 勉強会「 gopher 会」とその内容の紹介
andpad
0
250
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
1
850
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
240
AIコーディング道場勉強会#2 君(エンジニア)たちはどう生きるか
misakiotb
1
240
iOSアプリ開発で 関数型プログラミングを実現する The Composable Architectureの紹介
yimajo
2
210
なぜ適用するか、移行して理解するClean Architecture 〜構造を超えて設計を継承する〜 / Why Apply, Migrate and Understand Clean Architecture - Inherit Design Beyond Structure
seike460
PRO
1
290
[初登壇@jAZUG]アプリ開発者が気になるGoogleCloud/Azure+wasm/wasi
asaringo
0
130
都市をデータで見るってこういうこと PLATEAU属性情報入門
nokonoko1203
1
550
来たるべき 8.0 に備えて React 19 新機能と React Router 固有機能の取捨選択とすり合わせを考える
oukayuka
2
830
Datadog RUM 本番導入までの道
shinter61
1
310
なぜ「共通化」を考え、失敗を繰り返すのか
rinchoku
1
410
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
The World Runs on Bad Software
bkeepers
PRO
69
11k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.3k
Visualization
eitanlees
146
16k
Navigating Team Friction
lara
187
15k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
The Invisible Side of Design
smashingmag
299
51k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
Building a Modern Day E-commerce SEO Strategy
aleyda
41
7.3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.8k
Become a Pro
speakerdeck
PRO
28
5.4k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
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?