1. 下载 xdebug 插件,并修改php配置文件
- 打开官网下载位置
此处需要在区域框中输入,phpinfo()打印的信息,根据php的版本信息来确定 xdebug 的版本
https://xdebug.org/wizard
- 使用phpinfo()函数来获取 xdebug 对应版本插件
- 在php文件中执行phpinfo()函数,打开phpinfo网页 --> 右键,查看网页源代码 --> 拷贝所有源代码,放入 xdebug 官网的区域框中
- 点击下方 Analyse my phpinfo() output 按钮(注意,php版本过低,将无法使用xdebug,建议7以上)
- 根据 Instructions 提示进行操作,提示如下:
Download php_xdebug-3.1.6-7.4-vc15-x86_64.dll
Move the downloaded file to F:\p\xampp\xampphome\php\ext, and rename it to php_xdebug.dll
Update F:\p\xampp\xampphome\php\php.ini and add the line:
zend_extension = xdebug
Restart the Apache Webserver
- 在 F:\p\xampp\xampphome\php\php.ini 最下面加上
zend_extension = xdebug
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_mode = "req"
xdebug.remote_port = 9000
xdebug.idekey = "PHPSTORM"
2. 配置 phpstorm 编辑器
点击右上角下拉框 --> Edit Configurations --> 点击 + 号 --> PHP Web Page
Name 自定义
Server name:自定义,Host:localhost
Start URL php文件路径,比如:/mypro/public/index.php
// 在下方显示完整的调试页面地址
点击ok
3. 开启断点调试
点击右上角绿色爬虫图标打开调试页面并进入断点调试
f5键 一步一步进行调试












网友评论