1. 程式人生 > >Eclipse for php + Xdebug搭建PHP的調試環境

Eclipse for php + Xdebug搭建PHP的調試環境

mark tables ons ips 否則 tab www. 分享 pack

第一步:到Eclipse的官網去下載PHP-Eclipse:http://www.eclipse.org/downloads/packages/eclipse-php-developers/heliossr1

第二步:下載Xdebug (下載地址位於:http://xdebug.org/download.php,我的PHP版本為 PHP 5.3.28 Thread Safety, Apach為2.2.25,使用的端口號8080),我下載的Xdebug版本為php_xdebug-2.2.3-5.3-vc9.dll,並且放入到"PHP/ext目錄中。

第三步:在PHP5裏面找到php.ini,在這個文件的最後面加入如下配置信息:

zend_extension = D:\php\ext\php_xdebug-2.2.3-5.3-vc9.dll

;zend_extension_ts = D:\php\ext\php_xdebug-2.2.3-5.3-vc9.dll

;extension = php_xdebug-2.2.3-5.3-vc9.dll

[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

xdebug.trace_output_dir=”D:/xDebugLog”

xdebug.profiler_output_dir=”D:/xDebugLog”

xdebug.profiler_enable=On

xdebug.remote_host=localhost

xdebug.remote_port=9000

xdebug.remote_handler=dbgp

這裏要特別註意:如果在文件裏有其他的zend_extension_ts,需要註釋掉,否則apache無法啟動。

第四步:啟動apache。

第五步:在eclipse的項目裏的Properties裏面找到"PHP Debug",在PHP Debugger裏面選擇"XDebug"

技術分享圖片

技術分享圖片

技術分享圖片

第六步:再在Windows->Preferences裏面配置下PHP Servers

技術分享圖片

技術分享圖片

第七步:再在Windows->Preferences裏面配置下PHP Executables

技術分享圖片

技術分享圖片

第八步:再在Run->Debug Configurations裏面確認Path Mapping的配置和第六步中的一致。

技術分享圖片

接下來,進入debug界面,就可以開始設置斷點進行debug了。

Eclipse for php + Xdebug搭建PHP的調試環境