chrome瀏覽器下的xdebug helper使用方法
自從安裝了xdebug后,發現每次調試都需要從eclipse中先從頭啟動,然后一步步走到你要調試的頁面,而不是說想什么時候調試就什么時候調試。
之前用zenddebugger的時候則是可以在任意頁面啟動調試,直接從瀏覽器通知開發環境需要調試。而不用先從開發環境啟動調試。隨時需要調試的時候就可以執行調試。
后來發現了chrome瀏覽器有一款插件叫xdebug helper,火狐下也有easy xdebug,下面主要來說chrome下的xdebug helper
安裝完成xdebug helper后再瀏覽器地址欄的右側能夠看到一只小爬蟲,點擊后如下圖所示:
選擇Debug,就會通知你的開發環境接下來的代碼需要開始調試,選擇disable,就會直接運行。
在eclipse中需要進行特別的設置:
進入window->Preferences->PHP->Debug
找到配置xdebug中的Accept remote session(JIT),選擇為localhost,並保存。
在PHP的配置文件中對xdebug的設置需要特別注意,將xdebug.remote_autostart設置為off,如果設置為on,則會忽略在瀏覽器中是選擇Debug還是Disable,都會通知eclipse進行調試
xdebug.remote_autostart = Off
這樣,xdebug helper就設置好了
以下是我的php.ini中對xdebug的配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[Xdebug] ;xdebug配置
zend_extension="e:/php/ext/php_xdebug-2.2.1-5.4-vc9.dll" ;載入Xdebug
xdebug.profiler_enable=on
xdebug.trace_output_dir="e:/xdebug-log" ;xdebug 的數據文件目錄
xdebug.profiler_output_dir="e:/xdebug-log" ;xdebug 的數據文件目錄
xdebug.auto_trace = On ;開啟自動跟蹤
xdebug.show_exception_trace = On ;開啟異常跟蹤
xdebug.remote_autostart = Off ;開啟遠程調試自動啟動
xdebug.remote_enable = On ;開啟遠程調試
xdebug.remote_handler=dbgp ;用於zend studio遠程調試的應用層通信協議
xdebug.remote_host=127.0.0.1 ;允許連接的zend studio的IP地址
xdebug.remote_port=9000 ;反向連接zend studio使用的端口
xdebug.collect_vars = On ;收集變量
xdebug.collect_return = On ;收集返回值
xdebug.collect_params = On ;收集參數
xdebugbug.max_nesting_level = 10000 ;如果設得太小,函數中有遞歸調用自身次數太多時會報超過最大嵌套數錯
|