博客
关于我
PHP 设置调试工具XDebug PHPStorm IDE
阅读量:793 次
发布时间:2023-02-28

本文共 1175 字,大约阅读时间需要 3 分钟。

安装XDebug并配置PHPStorm调试工具

安装XDebug扩展是PHP开发中调试的重要工具之一。以下是安装与配置步骤:

1. 安装XDebug扩展

首先,访问XDebug官方网站:https://xdebug.org,下载适合当前PHP版本和操作系统的XDebug扩展。复制PHP信息并粘贴到XDebug配置工具中:https://xdebug.org/wizard.php,工具会自动识别PHP版本并提供相应的安装包和配置说明。

2. 配置XDebug

将下载的XDebug扩展文件复制到PHP安装目录下的ext子目录中。然后编辑php.ini文件,在配置末尾添加以下设置:

zend_extension=C:\path\php\ext\php_xdebug-2.4.0rc4-5.6-vc11-x86_64.dll
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM

完成后,重启Apache或Nginx服务。

3. 配置PHPStorm调试环境

打开PHPStorm,进入File > Settings > PHP > Servers,填写服务器信息:

  • name: 服务器名称(如localhost
  • host: 服务器IP地址或域名(如localhost
  • port: 端口号(默认80)
  • debugger: 选择XDebug

如果使用自定义域名,确保在host字段中填写域名地址。

4. 配置调试选项

进入File > Settings > PHP > Debug,选择XDebug选项卡:

  • port: 设置为9000
  • DBGp Proxy
    • IDE key: PHPSTORM
    • host: localhost
    • port: 80

5. 添加调试配置

点击菜单栏的Run > Edit Configurations…,在弹出的窗口中添加调试配置:

  • 点击左上角的+,选择PHP Web Application
  • 填写配置信息,完成后设置代码中的断点,启动调试。

6. 安装XDebug Helper

下载并安装XDebug Helper浏览器插件。在插件选项中选择PHPSTORM,可以设置域名过滤,避免默认显示小甲虫。

注意事项

  • 确保XDebug Helper正确安装并设置IDE key。
  • 调试前确保服务器已启动,并且代码已设置断点。
  • 如需调试多个项目,可以添加多个调试配置。

完成以上配置后,开启XDebug Helper,设置断点后,点击电话图标启动调试,即可在浏览器中查看调试结果。

转载地址:http://tztfk.baihongyu.com/

你可能感兴趣的文章
oracle零碎要点---oracle em的web访问地址忘了
查看>>
Oracle零碎要点---多表联合查询,收集数据库基本资料
查看>>
Oracle静默安装
查看>>
Oracle面试题:Oracle中truncate和delete的区别
查看>>
ThreadLocal线程内部存储类
查看>>
thinkphp 常用SQL执行语句总结
查看>>
Oracle:ORA-00911: 无效字符
查看>>
Text-to-Image with Diffusion models的巅峰之作:深入解读 DALL·E 2
查看>>
TCP基本入门-简单认识一下什么是TCP
查看>>
tableviewcell 中使用autolayout自适应高度
查看>>
Orcale表被锁
查看>>
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned
查看>>
org.apache.poi.hssf.util.Region
查看>>
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /
查看>>
org.hibernate.HibernateException: Unable to get the default Bean Validation factory
查看>>
org.hibernate.ObjectNotFoundException: No row with the given identifier exists:
查看>>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
查看>>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
查看>>
org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size exceeded
查看>>
org.tinygroup.serviceprocessor-服务处理器
查看>>