折騰了一下午zend studio 9.0.3 +WampServer2.2+ZendDebuger的debug配置,
官方文檔 baidu google 全用上了 反復折騰,也沒搞定zend debuger,估計是 5_3_x_nts_comp的ZendDebugger 不支持WampServer2.2自帶的php5.3.13.
希望成功搞定的朋友 指教下!
最后決定使用WampServer2.2自帶的xdebug 調試PHP代碼。
配置步驟如下:
一、wamp端 xdebug 配置
1.找到wamp的apache安裝目錄
我的安裝目:
C:\wamp\bin\apache\apache2.2.22\bin\
2.打開php.in文件,找到“; XDEBUG Extension”所在位置
原樣如下:
; XDEBUG Extension
zend_extension = "c:/wamp/bin/php/php5.3.13/zend_ext/php_xdebug-2.2.0-5.3-vc9.dll"
[xdebug]
xdebug.remote_enable = off
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
修改XDEBUG后的信息如下:
; XDEBUG Extension
zend_extension = "c:/wamp/bin/php/php5.3.13/zend_ext/php_xdebug-2.2.0-5.3-vc9.dll"
[xdebug]
xdebug.remote_enable = on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
簡單說明如下:
允許遠程調試:xdebug.remote_enable = on
默認調試協議:xdebug.remote_handler=dbgp
遠程服務器IP地址(localhost指的是本機):xdebug.remote_host=localhost
默認端口:xdebug.remote_port=9000
至此,wamp端 xdebug 配置完成。
二、zendstudio端xdebug 配置
1.打開zendstudio9.0.3,依次選擇 windows->preferences->PHP->PHP Executables Add 新的PHP Executables
如下圖所示:
配置debug如下圖所示:PS:http://localhost:8080 是我本地的apache server 運行地址,你可以改成你自己的server地址。
至此,zendstudio端,xdebug的配置也完成了。
三、測試配置成果
在zendstudio中新建php 項目,建議content選擇basic類型的,之后一路next就行了。
步驟如下圖所示:
打開創建好的index.php,加入如下測試代碼,保存文件。
<?php echo "Hello World"; echo "This spans multiple lines. The newlines will be output as well"; echo "This spans\nmultiple lines. The newlines will be\noutput as well."; echo "Escaping characters is done \"Like this\"."; ?>
下面開始調試:
第一步,右鍵單擊你剛剛創建好的工程,選擇debug as,如下圖所示:
出現如下圖所示的效果,說明你的xdebug 配置成功。
想到哪里寫到哪里,有什么看不懂的地方歡迎來電來函.呵呵