sp

Xdebug vscode docker

Jan 24, 2022 · Add this to your app.dockerfile: PHP ARG USE_XDEBUG=false RUN if [ $ {USE_XDEBUG} = true ]; then \ # Install the xdebug extension pecl install xdebug && \ docker - php - ext - enable xdebug && \ chmod 777 / usr / local / etc / php ; fi Meaning: Define a parameter USE_XDEBUG with default value false If USE_XDEBUG is true then install xdebug.

Feb 02, 2022 · After a request to our docker container, Xdebug will initiate a connection with our IDE. In our case, we will be using Visual Studio Code with PHP Tools. Dockerfiles We'll be using PHP with Nginx, just like in our previous article. Let's start by modifying PHP Dockerfile: FROM php:fpm RUN pecl install xdebug RUN docker-php-ext-enable xdebug.

Web.

gg

qd

gm

Web. VSCode and Xdebug We can proceed now to open VSCode. On VSCode make sure to have installed the PHP Debug extension. Next, click on Open folder... and locate the folder we just created above and select it. You should see the two files "Dockerfile" and "index.php" Open the "index.php" file.

If you are running docker on the same host as VSCode, then you should be able to trigger debug connections with the following (If you're system supports host.docker.internal ): XDEBUG_CONFIG="client_port=9000 client_host=host.docker.internal remote_enable=1" php test.php Code language: JavaScript (javascript).

Web.

wz