Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
xdebug remote debugging
Search
oscar.lee
November 05, 2014
Technology
95
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
xdebug remote debugging
oscar.lee
November 05, 2014
More Decks by oscar.lee
See All by oscar.lee
How to make sublime plugin
oscar3x39
0
77
web2.0 attack & defence
oscar3x39
0
160
Other Decks in Technology
See All in Technology
AIエージェント時代のPlatform as a Product —— テックリードがPdMとして回す発見・導入・計測 / Platform as a Product in the AI Agent Era
toshi0607
0
230
「今盗んで、後で解く」に備える ― AWSのポスト量子暗号入門
yama3133
2
250
AIは推し活である。
kurazuuuuuu
2
980
ADKで始める業務改善 - AIエージェント開発時の考えと設計
harappa80
2
290
AIに書かせて、プラットフォームで縛る ― EKSプラットフォームで実践した責任境界と権限設計
elmodev09
0
640
リアーキテクチャ後の障害ゼロを目指したShadow Testingの取り組み
nihonbuson
PRO
1
180
AI Native Platform Engineering 〜PlatformとAgileで“作る速さ”を“価値”へ〜
uya116
0
190
AIエージェントの一手は 誰も見ていない - Falco拡張OSS「Prempti」とeBPFで サーバーレス実行基盤を二層防御する
keitah
1
590
GoのInterface内部構造から学ぶ!最高パフォーマンスを出すコード設計
yappli_developers
1
300
EventBridge に「合流」はない ― サーバーレスのワークフローを育てるということ / No Join in EventBridge
yusukeshimizu
2
570
C#コードの結合を可視化する Roslyn解析による設計改善と リファクタリング判断
dora56
0
790
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
730
Featured
See All Featured
The Limits of Empathy - UXLibs8
cassininazir
1
690
Code Review Best Practice
trishagee
74
20k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
2k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
420
Odyssey Design
rkendrick25
PRO
2
820
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Unsuck your backbone
ammeep
672
58k
How to Think Like a Performance Engineer
csswizardry
28
2.8k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
330
Transcript
Xdebug! remote debugging! author:
[email protected]
簡介 Xdebug是⼀一個開放源代碼的PHP程序調試器 可以⽤用來跟踪,調試分析PHP程序的運⾏行狀況。
環境 Remote centos + nginx + php + Xdebug Local
SublimeText + SublimeTextXdebug Browser (chrome) ! ! Xdebug Helper
Remote 安裝Xdebug yum install php-devel yum install php-pear yum install
gcc gcc-c++ autoconf automake pecl install Xdebug
Remote 設定Xdebug locate php.ini //尋找php.ini位置 vi /etc/php.ini ! //加⼊入xdebug.so 路徑
zend_extension=/usr/lib64/php/modules/xdebug.so ! [xdebug] xdebug.remote_port=9000 xdebug.remote_enable=1 xdebug.remote_connect_back=1 xdebug.remote_handler=dbgp xdebug.remote_host=127.0.0.1 xdebug.remote_autostart=1 xdebug.profiler_enable=1
Remote設定nginx vi /etc/nginx/sites-available/xxxx.com location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index
index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/ $fastcgi_script_name; fastcgi_param APPLICATION_ENV development; } ! vi /etc/php-fpm.d/www.conf [www] listen = 127.0.0.1:9000 ! 重起⽣生效 service php-fpm restart service nginx restart
Local 安裝SublimetextXdebug⽅方式 需Packge Control Mac:Command + Shift + P Win:
Ctrl + Shift + P
Local SublimeTextXdebug設定 在專案根⺫⽬目錄下新增xdebug.sublime-project { "folders": [ { "follow_symlinks": true, "path":
"." } ], "settings": { "xdebug": { "path_mapping": { “/var/www/html/xxxx" : “~/wwwroot/project/xxxx", }, "url": “http://www.hiiir.com/api/v1”, "super_globals": true, "close_on_stop": true } } }
Chrome 安裝 XdebugHelper https://chrome.google.com/webstore/detail/xdebug-helper/ eadndfjplgieldjbigjakmdgkmoaaaoc
Xdebug Helper使⽤用 xdebug helper 設定到 Debug模式
功能簡介 Start/Stop debugging session ( 啟動/關閉 Xdebug ) add/remove breakpoint
( 斷點,執⾏行到此會停住 ) Set watch expression ( 建⽴立觀察 ) Step over ( 遇到函式呼叫時,確定該函式不會有問題時使⽤用 ) Step into ( 遇到函式呼叫時跳進該函式 ) Step out ( 在函式中確認後⾯面程式無誤,跳⾄至上⼀一層 ) Session Evaluate ( 等同eval($code) )
視窗簡介 • Xdebug Context ( 觀察⺫⽬目前所有變數狀態 ) • Xdebug Watch
( 觀察某變數,歷程變化狀態 ) • Xdebug Stack ( 執⾏行 檔案⾏行⾛走路徑 ) • Xdebug Breakpoint ( 斷點⾏行數 )
測試程式 <?php ! $x = 1; $y = 2; !
if ($x + $y == 2) { switch ($z) { case 'cat': echo 'meow '; case 'dog': echo 'Wang '; default: break; } } else { echo 'end'; } ⺫⽬目標: 輸出meow wang ! ! 1. 改變 $x = 0 結果 $x + $y = 2 ! 2. 新增 $z = ‘cat’; 結果 echo ‘meow’; ! 3.改變 $z = ‘dog’; 結果 echo ‘Wang’;
啟動伺服器 php -S localhost:8000
斷點 右鍵 Add Breakpoint 或者 Fn + Command +F8
啟動Sublime Xdebug Shift + Command + P! Xdebug: Start Debugging
斷點視窗 Xdebug Breakpoint
執⾏行位置 斷點
Session Evaluate $x = 0;
Xdebug Step Into
Xdebug Step Into
> session evaluate $y = ‘cat’; > step into >
session evaluate $y = ‘dog’; > Run ! switch ($y) { case 'cat': echo 'meow '; case 'dog': echo 'Wang '; default: break; } Run
Timeout http://php.net/manual/es/function.set-time- limit.php! max_execution_time = 30
Q&A