首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未运行docker容器的Xdebug 3

未运行docker容器的Xdebug 3
EN

Stack Overflow用户
提问于 2021-12-04 05:52:56
回答 1查看 105关注 0票数 0

我似乎不能让我当前的Xdebug在VSCode中工作。我错过什么了吗?我尝试运行调试并使用断点转到我的localhost:8001,但是没有断点被破坏……

我的docker-compose.yaml

代码语言:javascript
复制
version: '2'
services:
  php:
    image: yiisoftware/yii2-php:7.4-apache
    build: 
      context: .
      dockerfile: Dockerfile
    volumes:
      - ~/.composer-docker/cache:/root/.composer/cache:delegated
      - ./../../:/app:delegated
    ports:
      - '8001:80'

我的Dockerfile

代码语言:javascript
复制
FROM yiisoftware/yii2-php:7.4-apache

# Install Xdebug
RUN pecl install -f xdebug && docker-php-ext-enable xdebug
COPY /xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

我的xdebug.ini

代码语言:javascript
复制
zend_extension = xdebug_extension

[XDebug]
# xdebug 3
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9003
xdebug.client_host = 'host.docker.internal'
xdebug.log = /tmp/xdebug.log

launch.json

代码语言:javascript
复制
{
    // 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",
            "port": 9003,
            "log": true,
            "pathMappings": {
                "/app": "${workspaceRoot}"
            },
            "hostname": "0.0.0.0",
            "xdebugSettings": {
                "max_data": 65535,
                "show_hidden": 1,
                "max_children": 100,
                "max_depth": 5
            }
        },
    ]
}
EN

回答 1

Stack Overflow用户

发布于 2021-12-04 08:41:19

解决了,我改变了我的Dockerfile。

之前的

代码语言:javascript
复制
COPY /xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

之后的

代码语言:javascript
复制
COPY /xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70223360

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档