自從安裝了xdebug後,發現每次調試都須要從eclipse中先從頭啓動,而後一步步走到你要調試的頁面,而不是說想何時調試就何時調試。php
以前用zenddebugger的時候則是能夠在任意頁面啓動調試,直接從瀏覽器通知開發環境須要調試。而不用先從開發環境啓動調試。隨時須要調試的時候就能夠執行調試。chrome
後來發現了chrome瀏覽器有一款插件叫xdebug helper,火狐下也有easy xdebug,下面主要來講chrome下的xdebug helper瀏覽器
安裝完成xdebug helper後再瀏覽器地址欄的右側可以看到一隻小爬蟲,點擊後以下圖所示:session
選擇Debug,就會通知你的開發環境接下來的代碼須要開始調試,選擇disable,就會直接運行。app
在eclipse中須要進行特別的設置:eclipse
進入window->Preferences->PHP->Debug
找到配置xdebug中的Accept remote session(JIT),選擇爲localhost,並保存。函數
在PHP的配置文件中對xdebug的設置須要特別注意,將xdebug.remote_autostart設置爲off,若是設置爲on,則會忽略在瀏覽器中是選擇Debug仍是Disable,都會通知eclipse進行調試spa
xdebug.remote_autostart = Off
這樣,xdebug helper就設置好了.net
如下是個人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 ;若是設得過小,函數中有遞歸調用自身次數太多時會報超過最大嵌套數錯
|