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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Vladimír Kriška
December 08, 2011
Programming
290
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Xdebug / debugging PHP applications (WebElement #2)
Vladimír Kriška
December 08, 2011
More Decks by Vladimír Kriška
See All by Vladimír Kriška
Twelve-Factor app with Docker
ujovlado
0
180
Design a REST API you will love to work with
ujovlado
0
800
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
520
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
420
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
190
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
130
CSS Flexbox (WebElement #35)
ujovlado
0
200
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
200
Don't underestimate CSS (WebElement #30)
ujovlado
0
640
Other Decks in Programming
See All in Programming
Lessons from Spec-Driven Development
simas
PRO
0
190
AutonomyとControlのあいだ:Graflowで記述するAIエージェント協調
myui
0
120
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
160
Vite+ Unified Toolchain for the Web
naokihaba
0
290
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
190
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
130
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
330
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
130
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
540
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
540
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
330
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
50
15k
Prompt Engineering for Job Search
mfonobong
0
340
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
190
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
140
Six Lessons from altMBA
skipperchong
29
4.3k
エンジニアに許された特別な時間の終わり
watany
107
250k
Building Applications with DynamoDB
mza
96
7.1k
New Earth Scene 8
popppiees
3
2.3k
How GitHub (no longer) Works
holman
316
150k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
Embracing the Ebb and Flow
colly
88
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?