環境配置
PhpStorm 2018.3.6
2019.1的識別不了xdebug
xampp-windows-x64-7.1.26-0-VC14-installer
安裝路徑:D:\xampp
集成了php_xdebug.dll
chrome插件 : JetBrains IDE Support
xampp設置
編輯D:\xampp\php\php.ini
在[xdebug]添加內容:
[xdebug]
zend_extension="D:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_autostart=on
xdebug.auto_trace = On
xdebug.show_exception_trace = On
xdebug.remote_enable=on
xdebug.remote_enable=1
xdebug.remote_mode="req"
xdebug.remote_log="D:\xampp\htdocs\log\xdebug.log"
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_handler="dbgp"
xdebug.idekey="PHPSTORM"
xdebug.remote_autostart = On
xdebug.collect_vars = On
xdebug.collect_return = On
xdebug.collect_params = On
xdebug.trace_output_dir="D:\xampp\htdocs\log"
xdebug.show_local_vars = On
xdebug.profiler_enable = On
xdebug.profiler_output_dir ="D:\xampp\htdocs\log"
xdebug.trace_enable_trigger =On
要在D:\xampp\htdocs
新建文件夾log
查看xdebug是否生效
php -m
[Zend Modules]
Xdebug
PhpStorm設置
打開Settings\Languages & Frameworks\PHP
配置如下:
PHP language level: 根據選擇項目PHP版本
CLI interpreter: 添加一個
Name: PHP 7.1
PHP executable: D:\xampp\php\php.exe
include path: D:/xampp/php #根據需要添加
打開Settings\Languages & Frameworks\PHP\Debug\DBGp Proxy
配置如下:
IDE key: PHPSTORM
Host: localhost
Port: 9001
打開Settings\Languages & Frameworks\PHP\Servers
配置如下:
Name: localhost
Host: 127.0.0.1
Port: 63342 #PhpStorm Builtin server端口號是63342
Debugger: Xdebug
新建PHP項目,放在D:\xampp\htdocs
,點擊右上角Edit Configuration
,新建PHP Web Page
配置如下:
Name: php7
Server: localhost
Start URL: /tp5.1.20/public/ #我的文件路徑D:\xampp\htdocs\think\tp5.1.20\public
Browser: Chrome
把右上角監聽變量的圖標點綠,這樣才能記錄變量,點擊綠色的調試按鈕進行調試。