服務器使用XAMPP軟件,並且按照目錄為 C:\xampp
一、php.ini 設置
打開php.ini(目錄 C:\xampp\php) 並設置成如下
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable = 1
xdebug.remote_host= localhost
xdebug.remote_mode = "req"
xdebug.remote_port = 9000
xdebug.idekey = PHPSTORM
其中:
zend_extension:表示我們的xdebug文件
xdebug.remote_enable:1 表示開啟遠程測試
xdebug.remote_host : 測試服務器
xdebug.remote_port :遠程測試端口
xdebug.idekey :標識
二、瀏覽器安裝Xdebug
這里使用的火狐瀏覽器
1、安裝 xdebug插件
2、安裝成功后瀏覽器中會有兩個圖標,表示安裝成功
三、PhpStrom 設置
1、file->settings->languages & Framework ->PHP -> debug
如下圖,這里設置的是調試端口。這里一定要和步驟一種的 xdebug.remote_port 端口號相同
2、file->settings->languages & Framework ->PHP -> debug->DbGp Proxy
3、file->settings->languages & Framework ->PHP -> servers
4、run->Edit configurations
5、開始測試
四、配置完成,開始測試
1、打開火狐瀏覽器,點擊bug圖標
此時,圖標由灰變綠,表示瀏覽器開始調試狀態。
2、打開phpstorm監聽設備
點擊電話按鈕,變成全綠表示phpstorm處於調試狀態。
3、在火狐瀏覽器中輸入網址,成功中斷。