1.下載xdebug文件php
https://xdebug.org/download.phpweb
必定下載與本身PHP版本想匹配的xdebug文件chrome
好比 個人是php版本 64位 5.6.21 apache
下載是(PHP 5.6 VC11 TS (64 bit) )ts 表示線程安全版本瀏覽器
2.配置php.ini,在末尾加上。安全
;xdebug配置
[Xdebug]
;載入Xdebug
zend_extension="D:/xampp/php/ext/php_xdebug.dll"
xdebug.idekey="PHPSTORM"
;開啓自動跟蹤
xdebug.auto_trace = On
xdebug.profiler_enable=on
;xdebug 的數據文件目錄
xdebug.trace_output_dir="D:/xampp/php/debuginfo"
;xdebug 的數據文件目錄
xdebug.profiler_output_dir="D:/xampp/php/debuginfo"
;開啓異常跟蹤
xdebug.show_exception_trace = On
;開啓遠程調試自動啓動
xdebug.remote_autostart = Off
;開啓遠程調試
xdebug.remote_enable = On
;用於zend studio遠程調試的應用層通訊協議
xdebug.remote_handler=dbgp
;容許鏈接的zend studio的IP地址
xdebug.remote_host=localhost
;反向鏈接zend studio使用的端口
xdebug.remote_port=9090
;收集變量
xdebug.collect_vars = On
;收集返回值
xdebug.collect_return = On
;收集參數
xdebug.collect_params = On
;若是設得過小,函數中有遞歸調用自身次數太多時會報超過最大嵌套數錯
xdebugbug.max_nesting_level = 10000服務器
保存文件,從新啓動apache檢查是否成功開啓了xdebug服務。ide
一種方法爲在CMD裏輸入D:\xampp\php\php.exe -m 看到XDebug,說明成功開啓XDebug。函數
另外一種方法爲瀏覽器打開localhost,找到phpinfo()點擊打開配置狀況,查找xdebug項,找到了說明xdebug配置成功。spa
3.chrome的xdebug配置
下載擴展程序 Xdebug helper
設置
4.phpStorm的相關配置
打開phpStorm,
-進入File>Settings>PHP>Servers,這裏要填寫服務器端的相關信息,name填localhost,host填localhost,port填80,debugger選XDebug
-進入File>Settings>PHP>Debug,看到XDebug選項卡,port填9090(隨意避免端口衝突),其餘默認
-進入File>Settings>PHP>Debug>DBGp Proxy,IDE key 填 phpStorm,host 填localhost,port 填9090
-點OK退出設置
5.設置監聽 和本地web server
-點OK退出設置
至此,本身能夠去設置斷點進行調試了