Git Product home page Git Product logo

Comments (2)

bluesherpa avatar bluesherpa commented on June 2, 2024 2

Figured it out in case anyone else runs into this question...

Here is what I did to enable debugging of PHP scripts running in a Docker dev container when the scripts are called from my local browser...

From Visual Studio Code:
F1 > Dev Containers: New Dev Container > PHP & MariaDB

Once the container is built, go into .devcontainer\devcontainer.json:

  1. add port 9000 to the forwardPorts
  2. uncomment the "postCreateCommand", you'll have to add a comma in front of the line.

Add .vscode\launch.json - see attached copy. I had to modify the default file created by Visual Studio Code - the first configuration for "Listen for Xdebug" defaulted to port 9003, but it's supposed to be port 9000.

F1 > Rebuild container

Open a Terminal window and run "apache2ctl start"

I created index.php and put a couple of lines of PHP code and then added a debug breakpoint to a line at the beginning.

At the bottom of Visual Studio Code, I clicked "Listen for Xdebug". That put VS Code into debug mode.

Open a local browser window to http://localhost/?XDEBUG_SESSION_START=myDebug

The browser started to load the page and VS Code started stepping through the code :)

Let me know if you have any questions about this...

from templates.

samruddhikhandale avatar samruddhikhandale commented on June 2, 2024

This is wonderful, thank you so much for taking the time in sharing this valuable information. Appreciate it ✨

Closing this issue as it's resolved.

from templates.

Related Issues (20)

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.