目标
- 能在本地的 PHPstrom 单步骤调试
- 能在浏览器的模式下单步调试
安装扩展
- 安装扩展 xdebug , 具体步骤省略,
- 本文只讲解一些配置
php.ini 配置扩展参数
zend_extension=php_xdebug
xdebug.profiler_enable=on
xdebug.trace_output_dir="../xdebug"
xdebug.profiler_output_dir="../xdebug"
xdebug.remote_enable=On
xdebug.remote_port=9001
xdebug.idekey=PHPSTORM
xdebug.remote_connect_back = 1
PHPStorm 配置
-
配置调试端口
-
配置 servers 添加一个
-
开启 debug监听
-
打断点, 并开启一个虚拟服务器
- 访问
- 结果
本地单步调试
- 直接点调试按钮即可
- 注意: 运行的解释器需要开启 xdebug 扩展