PhpStorm配置XDebug调试PHP

1 PHP配置

首先需要配置PHP,请参考《XDebug安装配置教程》。

2 配置 XDebug

路径:File > Settings > Languages & Frameworks > PHP > Debug

phpstrom-debug-02.png

3 配置 Server

路径:File Settings Languages & Frameworks PHP Servers

phpstrom-debug-01.png

其中,Host 是调试时浏览器访问的域名。

注意:如果所谓的“远程服务器”就在本地的话,就不需要勾选“Use path mappings(select if the servers is remote or symlinks are used)

4 设置调试项

选择菜单 Run Edit Configurations,弹出“Run/Debug Configrations”对话框:

phpstrom-debug-03.png

phpstrom-debug-04.png

5 开始调试页面

Shift + F9,或菜单选择 Run > Debug 调试名称,开启调试。

phpstrom-debug-06.png

特别说明下:

如果选择了 Run > Start Listening for PHP Debug connections,则PHPStorm会监听浏览器,如果浏览器访问第4步的”Start Url“,那么PHPStorm会自动跳转到断点处。点击调试按钮,一步一步调试吧!

常用的几个快捷键:

  • F7:步入
  • F8:跳过
  • Shift + F8:步出
  • Alt + F9:调到光标处

所有快捷键最好从 Run 菜单下查看。

 

参考资料:

  1. 【总结1】PhpStorm配置XDebug(远程)调试PHP

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

昵称 *