password
tags
type
status
date
slug
summary
category
icon
背景
本地有PHP环境
在PHPSTORM中,想要对写好的PHP脚本进行调试,需要PHP开发环境有Xdebug插件。
下图展示,没有Xdebug插件是无法测试的。

安装
1、方式一:PhpStorm
当debug产生“Xdebug extension is not installed”错误,按照PhpStorm指示进行安装,安装好之后,进行校验:
在控制台执行php -v如果显示”with Xdebug v…”说明安装成功,就可以用了。

2、方式二:官网安装
https://xdebug.org/docs/install Xdebug安装
https://xdebug.org/docs/compat PHP-Xdebug版本对应关系

查看安装地址
3、方式三:pecl安装
pecl
是 PHP 扩展的包管理工具,用于安装和管理 PHP 扩展。PEAR是PHP的一个软件包管理系统,它包含了 PHP 扩展和应用程序。pecl
工具默认使用PEAR的pecl.php.net
作为主存储库。pecl.php.net
是PEAR官方的扩展和模块存储库,它包含了大部分PHP扩展的发行版本。
找到对应版本安装。

我的php版本是8.2,选择安装3.3.0,注意pecl会自动帮你在.ini文件中加Xdebug扩展配置
卸载
Laravel服务debug
一、启动laravel服务



二、配置remote debug
IDE key可以自行修改,这里我使用IDE的名称PHPSTORM

这里配置xdebug服务的端口

三、发起请求
在请求的cookie中增加XDEBUG_SESSION=PHPSTORM,成功debug

- Author:武帅祺
- URL:https://qqqi.top//article/35ee2a1b-5fb0-4a93-b454-a0d6a83f69ea
- Copyright:本文章为原创内容,版权归作者所有。如需转载,请联系我,谢谢!