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
78
Design a REST API you will love to work with
ujovlado
0
720
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
450
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
350
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
100
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
62
CSS Flexbox (WebElement #35)
ujovlado
0
130
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
140
Don't underestimate CSS (WebElement #30)
ujovlado
0
550
Other Decks in Programming
See All in Programming
Generating OpenAPI schema from serializers throughout the Rails stack - Kyobashi.rb #5
envek
1
450
Jakarta EE meets AI
ivargrimstad
0
810
メンテが命: PHPフレームワークのコンテナ化とアップグレード戦略
shunta27
0
340
PromptyによるAI開発入門
ymd65536
1
100
Domain-Driven Design (Tutorial)
hschwentner
13
22k
Boos Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
790
AWS Step Functions は CDK で書こう!
konokenj
5
930
PRレビューのお供にDanger
stoticdev
1
250
Goで作るChrome Extensions / Fukuoka.go #21
n3xem
0
150
CloudRun, Spanner に対する負荷試験の反省と オブザーバビリティによるアプローチ
oyasumipants
1
200
AIレビュー導入によるCIツールとの共存と最適化
kamo26sima
1
1.2k
The Price of Micro Frontends… and Your Alternatives @bastacon 2025 in Frankfurt
manfredsteyer
PRO
0
290
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.6k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
4
390
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
GraphQLとの向き合い方2022年版
quramy
44
14k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7.1k
A designer walks into a library…
pauljervisheath
205
24k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.7k
Testing 201, or: Great Expectations
jmmastey
42
7.2k
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?