Forked from ChrisTaylorDeveloper/vs-code-php-debug-docker-xdebug.md
Created
March 25, 2020 00:52
-
-
Save pydawan/57b6f0c7411de6f583b780ca8dafa94d to your computer and use it in GitHub Desktop.
Revisions
-
Chris Taylor revised this gist
Oct 17, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,6 +13,7 @@ RUN yes | pecl install xdebug \ && echo "xdebug.remote_connect_back=1" >> /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_port=9000" >> /usr/local/etc/php/conf.d/xdebug.ini ``` ## Bring up Docker container Run this shell script from the same folder as the Dockerfile <br>fire-up-docker.sh @@ -32,6 +33,7 @@ sudo docker run \ -p 8080:80 \ -d ctd/xdebug-tester:v1 ``` ## VS Code The php-debug extension configuration file in VS Code <br>launch.json -
Chris Taylor revised this gist
Oct 17, 2018 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ ## The Dockerfile Only add the `xdebug.remote_log` line if you need to troubleshoot. ``` FROM php:7.1-apache -
Chris Taylor created this gist
Oct 17, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ Dockerfile ``` FROM php:7.1-apache RUN yes | pecl install xdebug \ && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_host=172.17.0.2" >> /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_log=/var/www/html/xdebug.log" >> /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_connect_back=1" >> /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_port=9000" >> /usr/local/etc/php/conf.d/xdebug.ini ``` Run this shell script from the same folder as the Dockerfile <br>fire-up-docker.sh ``` # stop all containers sudo docker stop $(sudo docker ps -aq) # delete all containers sudo docker rm $(sudo docker ps -aq) sudo docker build -t ctd/xdebug-tester:v1 . sudo docker run \ --detach \ --name my-xdebug-tester \ --volume=/home/chris/my-php-project:/var/www/html \ -p 8080:80 \ -d ctd/xdebug-tester:v1 ``` The php-debug extension configuration file in VS Code <br>launch.json ```` { "version": "0.2.0", "configurations": [ { "name": "Listen for XDebug", "type": "php", "request": "launch", "port": 9000, "log": true, "pathMappings": { "/var/www/html": "/home/chris/my-php-project" } } ] } ````