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
210
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
52
Design a REST API you will love to work with
ujovlado
0
690
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
420
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
310
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
72
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
43
CSS Flexbox (WebElement #35)
ujovlado
0
110
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
110
Don't underestimate CSS (WebElement #30)
ujovlado
0
520
Other Decks in Programming
See All in Programming
破壊せよ!データ破壊駆動で考えるドメインモデリング / data-destroy-driven
minodriven
4
430
僕がつくった48個のWebサービス達
yusukebe
6
3.6k
テスト駆動開発✅️
akitoshiga
1
180
2024-10-01 dev2next - Observability for Modern JVM Applications
jonatan_ivanov
1
140
CSC509 Lecture 05
javiergs
PRO
0
190
LangChain & LangServeでAPIを爆速作成
kijitorabuti
2
370
perl for shell, awk and sed programmers
mackee
2
1k
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
240
Vue.js学習の振り返り
hiro_xre
1
100
画像でわかる北島直樹
naoki0917
0
140
Modern Angular with Lightweight Stores: New Rules and Options
manfredsteyer
PRO
0
200
Amazon Neptuneで始めてみるグラフDB-OpenSearchによるグラフの全文検索-
satoshi256kbyte
3
150
Featured
See All Featured
Optimizing for Happiness
mojombo
376
69k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3.5k
The Invisible Side of Design
smashingmag
297
50k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
The Cost Of JavaScript in 2023
addyosmani
44
5.9k
Writing Fast Ruby
sferik
626
60k
What's in a price? How to price your products and services
michaelherold
243
11k
Git: the NoSQL Database
bkeepers
PRO
425
64k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
4.9k
Building Adaptive Systems
keathley
38
2.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?