查看php路径相关信息
php --ini
安装xdebug
https://www.jetbrains.com/help/phpstorm/2024.1/configuring-xdebug.html?php.debugging.xdebug.configure
php.ini 配置
 在最后添加,以下是我的配置
[xdebug]
zend_extension=/opt/homebrew/Cellar/php@8.1/8.1.29/pecl/20210902/xdebug.so
xdebug.client_host=localhost
xdebug.client_port=9003
xdebug.mode=debug
xdebug.idekey = cdn
查看x-debug是否配置成功
php -m

phpstorm
setting

Xdebug的debug端口必须配置和php.ini中一致
-  server  
这里配置那个域名的那个服务要用xdebug
使用
-  启动服务 
-  添加PHP Remote Debug,server选择刚刚setting添加的server,IDE key填写php.ini中的xdebug.idekey 
-   
-  测试 使用apipost localhost:8000/api/login?XDEBUG_SESSION_START=cdn 注意: XDEBUG_SESSION_START=cdn 这个参数必须有,代码这个请求需要debug,值是php.ini中配置的