最近有小夥伴問我如何安裝 xdebug ,想了想決定寫篇博文,讓小夥伴們自己看好了。
說明:開發環境爲windows
首先 輸出 phpinfo(); 複製內容到 http://www.xdebug.org/find-binary.php
這一步其實就是 xdebug 官方幫你確定你的php開發版本 。
接着在彈出頁面下載相應 dll 文件,按照他的提示覆制到相應位置即可 通常爲php的ext擴展文件夾
最後打開你的php.ini 輸入以下內容
;加載xdebug擴展 zend_extension = .\ext\php_xdebug-2.5.0-5.6-vc11-nts.dll [Xdebug] ;是否開啓自動跟蹤 xdebug.auto_trace = On ;是否開啓異常跟蹤 xdebug.show_exception_trace = On ;是否開啓遠程調試自動啓動 xdebug.remote_autostart = On ;是否開啓遠程調試 xdebug.remote_enable = On ;允許調試的客戶端IP xdebug.remote_host=localhost ;遠程調試的端口(默認9000) xdebug.remote_port=9000 ;調試插件dbgp xdebug.remote_handler=dbgp ;是否收集變量 xdebug.collect_vars = On ;是否收集返回值 xdebug.collect_return = On ;是否收集參數 xdebug.collect_params = On ;跟蹤輸出路徑 xdebug.trace_output_dir="d:\xdebug" ;是否開啓調試內容 xdebug.profiler_enable=On ;調試輸出路徑 xdebug.profiler_output_dir="d:\xdebug"
更多的Xdebug配置選項說明,請參考官網的Xdebug配置選項說明。
OK 最後一步到了
第二步,打開netbeans,在工具-選項-php-調試框內,把調試器端口寫成和php.ini內xdebug.remote_port一致,點擊應用-確定。