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 #2)
Search
Vladimír Kriška
December 08, 2011
Programming
0
200
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
40
Design a REST API you will love to work with
ujovlado
0
630
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
370
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
270
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
67
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
39
CSS Flexbox (WebElement #35)
ujovlado
0
98
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
83
Don't underestimate CSS (WebElement #30)
ujovlado
0
510
Other Decks in Programming
See All in Programming
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
27
8.3k
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
8
4.1k
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
130
使ってみよう Azure AI Document Intelligence
kosmosebi
2
310
0→1と1→10の狭間で Javaという技術選定を振り返る/Reflecting on the Decision to Choose Java Between Scaling from 0 to 1 and 1 to 10
jaguar_imo
2
380
効率化に挑戦してみたらモバイル開発が少し快適になった話
ryunakayama
0
130
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
330
新宿ダンジョンを可視化してみた
satoshi7190
2
250
GitHub Copilotのススメ
marcy731
1
200
Snowflakeで眠ったデータを起こそう!
estie
0
120
データアナリストが行うDatabricksを活用したETLの自動化事例
shinoa
0
270
ONE WEDGE_company_guide
1wedge_one
0
480
Featured
See All Featured
Become a Pro
speakerdeck
PRO
11
4.5k
The Pragmatic Product Professional
lauravandoore
25
5.8k
Faster Mobile Websites
deanohume
299
30k
jQuery: Nuts, Bolts and Bling
dougneiner
59
7.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
14
1.6k
Product Roadmaps are Hard
iamctodd
44
9.7k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
25
2.3k
Done Done
chrislema
178
15k
Fireside Chat
paigeccino
21
2.6k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
6.9k
Scaling GitHub
holman
457
140k
Embracing the Ebb and Flow
colly
80
4.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?