简体   繁体   English

带有 docker 容器的 Xdebug 3 未运行

[英]Xdebug 3 with docker container not running

I can't seem to make my current xdebug work in vscode.我似乎无法让我当前的 xdebug 在 vscode 中工作。 Did I missed up anything, I tried to run the debug and go to my localhost:8001 with breakpoint but nothing breaking...我错过了什么吗,我尝试使用断点将调试和 go 运行到我的 localhost:8001 但没有任何中断...

My docker-compose.yaml我的 docker-compose.yaml

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'

My Dockerfile我的 Dockerfile

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

My xdebug.ini我的 xdebug.ini

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发射.json

{
    // 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
            }
        },
    ]
}

Solved, I change my Dockerfile解决了,我改变了我的 Dockerfile

Before : COPY /xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
After  : COPY /xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM