Coder Social home page Coder Social logo

bcamargogui / php-xdebug-docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from angristan/php-xdebug-docker

0.0 0.0 0.0 2 KB

Debug PHP with Xdebug inside Docker. Tested with PhpStorm and VS Code.

Home Page: https://angristan.xyz/debug-php-docker-xdebug-vscode-phpstorm/

Dockerfile 92.41% PHP 7.59%

php-xdebug-docker's Introduction

PHP/Xdebug/Docker example

Debug PHP with Xdebug inside Docker. Tested with PhpStorm and VS Code.

Usage

The Xdebug config happens in the Dockerfile. I recommend to look at it, escpeially the comments. The most important part is the xdebug.remote_host which has to be set to the Docker host.

A sample docker-compose.yml comes along with it so you can get this up and running in one command: docker-compose up --build -d.

VS Code configuration

Install the felixfbecker.php-debug extension.

You can create a debug configuration by going to Debug > Add Configuration... > PHP, but I've included the .vscode/launch.json file in the repo, with the correct folder maping.

Add a breakpoint, and click on "Listen for XDebug" in the top left hand corner. Load your page, and you should get debugging information:

PhpStorm configuration

You should not have to configure anything since we use the default debug port etc.

Add a breakpoint and start listening for Xdebug in the top right hand corner:

Load your page. PhpStorm will prompt you to add a "server" with a folder mapping:

And then magic happens:

Enjoy ๐Ÿ‘‹

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.