dnmp docker xdebug3 vscode 调试代码

docker-compose.yaml



version: '3.8'

services:

   php-container:

       build:

           context: .

           dockerfile: ./docker/Dockerfile

       volumes:

           - .:/var/www/html

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

           - ./docker/php.ini:/usr/local/etc/php/conf.d/custom.ini

       environment:

           PHP_IDE_CONFIG: "serverName=docker-cli"

        extra_hosts:

           - "host.docker.internal:host-gateway"



xdebug.ini
[XDebug]
zend_extension=xdebug.so
xdebug.mode = debug
xdebug.start_with_request=yes
#Replace host.docker.internal to your computers IP address if linux
xdebug.client_host=host.docker.internal



vscode


"version": "0.2.0",

   "configurations": [

       {

           "name": "Listen for Xdebug",

           "type": "php",

           "request": "launch",

           "hostname":"0.0.0.0",

           "stopOnEntry": true,

           "port": 9001,

           "pathMappings": {

               "/www/localhost/bim-xietong":"${workspaceFolder}"

           },

           "xdebugSettings": {

               "max_children": 10000,

               "max_data": 10000,

               "show_hidden": 1

           }

       },



2022.12.8   /   热度:482   /   分类: php

发表评论:

©地球仪的BLOG  |  Powered by Emlog