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
240
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
74
Design a REST API you will love to work with
ujovlado
0
710
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
450
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
340
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
94
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
58
CSS Flexbox (WebElement #35)
ujovlado
0
120
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
130
Don't underestimate CSS (WebElement #30)
ujovlado
0
540
Other Decks in Programming
See All in Programming
20241217 競争力強化とビジネス価値創出への挑戦:モノタロウのシステムモダナイズ、開発組織の進化と今後の展望
monotaro
PRO
0
340
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
1.1k
ペアーズでの、Langfuseを中心とした評価ドリブンなリリースサイクルのご紹介
fukubaka0825
1
160
Alba: Why, How and What's So Interesting
okuramasafumi
0
230
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
170
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
330
[JAWS-UG横浜 #79] re:Invent 2024 の DB アップデートは Multi-Region!
maroon1st
0
120
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
190
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
3
190
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
130
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
140
Оптимизируем производительность блока Казначейство
lamodatech
0
980
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
How to train your dragon (web standard)
notwaldorf
89
5.8k
Adopting Sorbet at Scale
ufuk
74
9.2k
Building Your Own Lightsaber
phodgson
104
6.2k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Music & Morning Musume
bryan
46
6.3k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
370
GitHub's CSS Performance
jonrohan
1030
460k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.5k
Become a Pro
speakerdeck
PRO
26
5.1k
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?