美文网首页
docker环境下使用xdebug调试php

docker环境下使用xdebug调试php

作者: 起起起起起 | 来源:发表于2019-08-07 21:38 被阅读0次

xdebug配置

zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_enable=1 #启用远程调试
xdebug.remote_autostart=1
xdebug.remote_port=9000 #端口
xdebug.remote_host=host.docker.internal #宿主机ip

remote_host是宿主机ip,因为是在宿主机下进行代码编写, remote_port=9000可能与fpm端口冲突,适当更改即可

vscode中的配置

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for XDebug",
      "type": "php",
      "request": "launch",
      "port": 9000,
      "pathMappings": {
        "/code/shopCrm": "/Volumes/work/shopCrm"
      }
    }
  ]
}

port是xdebug配置里面的remote_port
pathMappings里面, "/code/shopCrm"是容器里面代码的路径, "/Volumes/work/shopCrm"是宿主机里面代码的路径

相关文章

网友评论

      本文标题:docker环境下使用xdebug调试php

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