調試Php可選擇工具ZendDebugger或xdebug
因ZendDebugger目前版本最多支援Php5.2,不能支援最新的Php5.4,是以選擇xdebug
xdebug安裝方法
1.将下載下傳到的php_xdebug-xxx.dll命名為php_xdebug.dll,放到Php安裝目錄下的ext目錄中,例如D:\Program\PHP\ext
2.在Php的配置檔案php.ini中加入下面内容
[Xdebug]
;此處不能使用相對路徑
zend_extension = "D:/Program/PHP/ext/php_xdebug.dll"
;下面一條為最基本配置,其他選項可在頁面上檢視
xdebug.remote_enable=on
xdebug.profiler_enable=on
xdebug.trace_output_dir="D:/Program/Xdebug"
xdebug.profiler_output_dir="D:/Program/Xdebug"
xdebug.auto_trace = On
;開啟異常跟蹤
xdebug.show_exception_trace = On
;開啟遠端調試自動啟動
xdebug.remote_autostart = On
;開啟遠端調試
xdebug.remote_enable = On
;收集變量
xdebug.collect_vars = On
;收集傳回值
xdebug.collect_return = On
;收集參數
xdebug.collect_params = On
3.
重新開機apache伺服器後通路帶有phpinfo()的頁面,可以看到其中包含xdebug的資訊,即為安裝成功
PS
1.如果用extension=php_xdebug.dll方式安裝,會在頁面上看到XDEBUG NOT LOADED AS ZEND EXTENSION提示
2.按有的教程上将zend_extension寫作zend_extension_ts在頁面上找不到xdebug相關資訊
3.附下載下傳位址
xdebug
http://www.xdebug.org/files/php_xdebug-2.2.0-5.4-vc9.dll
http://www.xdebug.org/files/php_xdebug-2.2.0-5.4-vc9-nts.dll
ZendDebugger
http://downloads.zend.com/pdt/server-debugger/ZendDebugger-5.2.14-cygwin_nt-i386.zip