調試對於程序開發來說是至關重要的,今天搞了下eclipse開發php的調試環境,準備工具如下:
eclipse-php中all in one的版本,裏面已經包含了xdebug和zenddebug插件,下載xdebug.dll,可以到官網下載,下載和php相對應的版本,然後把該.dll放在php擴展目錄ext下即可。
php.ini增加xdebug的配置如下:
[xDebug]
zend_extension = "D:/php5.4.7/ext/php_xdebug-2.2.1-5.4-vc9.dll"
;開啓自動跟蹤
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="e:/php/debuginfo"
xdebug.profiler_enable=On
xdebug.profiler_output_dir="e:/php/debuginfo"
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
eclipse中php插件只要配置兩個地方即可,如下:
下面運行下debug即可在斷點中停下來了。