GithubHelp home page GithubHelp logo

docker-xdebug's Introduction

docker-xdebug

使用vscode远程调试docker容器内的php应用

经常使用docker搭建各种环境进行漏洞测试。如何调试docker内的代码的也成为了一个新需求。使用xdebug插件,可以方便的调试docker内的php应用。

docker环境安装xdebug

已经整合成docker-compose环境。可以直接clone github.com/stayliv3/docker-xdebug

修改xdebug.ini文件内的xdebug.remote_host=172.16.1.203 ip为vscode的机器IP(docker宿主机ip)。

vscode 配置

vscode安装PHP Debug Adapter for Visual Studio Code。

配置文件为:

{
    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            // "stopOnEntry": 1, 运行开始断点,用于调试。
            "serverSourceRoot": "/var/www/html/",
            "localSourceRoot": "/Users/xxxxx/security/coding/xdebug-docker/app"
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

主要是配置serverSourceRoot和localSourceRoot两个路径。localSourceRoot为vscode看到的php文件路径。然后就可以设置断点,使用vscode进行调试了。

docker-xdebug's People

Contributors

stayliv3 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.