美文网首页
2020-04-23 php xdebug 配置

2020-04-23 php xdebug 配置

作者: VimKid | 来源:发表于2020-04-23 17:10 被阅读0次
  1. 安装xdebug
    xdebug 配置
; 这个是节点名字 无所谓大小写
[XDebug]
; 允许远程 可以为 On 或者 1 都表示启用 , Off 和 0 表示关闭关闭
xdebug.enable=1
xdebug.remote_enable = 1
; 远程主机的 IP 这里我们填写,固定的 127.0.0.1 如果为docker 则这样写 host.docker.internal
xdebug.remote_host = 192.168.8.195
; 调试连接端口 请记住这个端口,后续会用到。此配置项默认值为 9000 ,但是通常 9000 端口被 fpm 占据 ,故更换端口。
; 另外,请在你服务器的控制面板和服务器防火墙中开放这个端口的进出站。
; 如果你是宝塔面板用户 请放行此端口。
xdebug.remote_port = 9002
; 接下来的值都是可选的,但是我推荐你使用
; 连接 IDE 的 Key,请记住他,可以自己自定义,主要用来过滤请求。
xdebug.idekey=PHPSTORM
; 这个表示扩展的位置,如果你是编译安装的,那么这个值你应该在第九步已经设置好了,如果你是 使用 包管理器安装的,那么这个值应该是自动设置的,而且你不会在这个 php.ini 中找到他,但是此时你已经不用设置它了。
; 如果你是宝塔的用户,你会发现在你编辑这个文件之前,宝塔已经帮你设置好了
; 另外,通常我建议你将路径使用引号包裹起来,因为当路径中有特殊字符或者空格时会出现问题

xdebug.profiler_enable=on
;xdebug.trace_output_dir="/usr/local/php/xdebug_trace"
;xdebug.profiler_output_dir="/usr/local/php/xdebug_profiler"
xdebug.default_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=0
xdebug.remote_autostart=1
; zend_extension=php_xdebug.dll

  1. vscode 配置
    launch.json
    远程调试 + centos虚拟机装docker 配置
{
   // Use IntelliSense to learn about possible attributes.
   // Hover to view descriptions of existing attributes.
   // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
   "version": "0.2.0",
   "configurations": [

       {
           "name": "Listen for XDebug",
           "type": "php",
           "request": "launch",
           "stopOnEntry":false,
            // 本地挂载文件路径
           "localSourceRoot": "Y://xxx/code/work-api",
           // 远程文件路径
           "serverSourceRoot": "/var/www/html/worker-service-env/code/work-api",
           "port": 9002,
           "pathMappings": {
                // 容器里代码路径:本地路径
               "/wwwroot/code/work-api": "Y://xxx/code/work-api"
           }
       },
   ]
}

远程调试 + 虚拟机lnmp 配置

{
   // Use IntelliSense to learn about possible attributes.
   // Hover to view descriptions of existing attributes.
   // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
   "version": "0.2.0",
   "configurations": [

       {
           "name": "Listen for XDebug",
           "type": "php",
           "request": "launch",
           "stopOnEntry":false,
            // 本地挂载文件路径
           "localSourceRoot": "Y://xxx/code/work-api",
           // 远程文件路径
           "serverSourceRoot": "/var/www/html/worker-service-env/code/work-api",
           "port": 9002,
       },
   ]
}
  1. phpstorm 配置`

相关文章

网友评论

      本文标题:2020-04-23 php xdebug 配置

      本文链接:https://www.haomeiwen.com/subject/ediaihtx.html