每次换了新项目都得配置,有时候配置不生效,记录一下。
一、phpstudy打开xdebug扩展
修改php.ini的配置 (改为对应php版本路径)
[Xdebug]
xdebug.idekey="PHPSTORM"
xdebug.remote_autostart=1
xdebug.mode = debug
xdebug.remote_mode= "req"
zend_extension=D:/phpstudy_pro/Extensions/php/php8.0.2nts/ext/php_xdebug.dll
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.auto_trace=Off
xdebug.trace_output_dir=D:/phpstudy_pro/Extensions/php_log/php8.0.2nts.xdebug.trace
xdebug.profiler_enable=On
xdebug.profiler_output_dir=D:/phpstudy_pro/Extensions/php_log/php8.0.2nts.xdebug.profiler
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000 #要和下面phpstorm配置对应
xdebug.remote_handler=dbgp
xdebug.default_enable=1
二、修改phpstorm配置
setting->Languages & Frameworks->PHP->Debug
在phpstorm右上角 add Configurations 选择add php web page
PS:可以打断点进行测试,有时候不生效记得重启一下phpstorm