-
-
Save kzap/fccce076a9fd7ea05d67538ed8cd8938 to your computer and use it in GitHub Desktop.
Connect to Xdebug running inside your PHP Container by building an image with Xdebug installed and running like this: `docker-compose -f docker-compose.xdebug.yml up`. Then the PHP inside your editor will connect to Xdebug running in your editor.
This file contains 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 characters
DOCKER_HOST_IP=IP.OF.YOUR.HOST.MACHINE.FROM.INSIDE.DOCKER |
This file contains 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 characters
FROM FROM php:7.0-apache | |
RUN pecl install xdebug | |
ARG HOST_IP | |
# set recommended PHP.ini settings | |
# see https://secure.php.net/manual/en/opcache.installation.php | |
RUN { \ | |
echo '[xdebug]'; \ | |
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)"; \ | |
echo 'xdebug.remote_enable=1'; \ | |
echo 'xdebug.remote_autostart=1'; \ | |
echo 'xdebug.remote_log="/tmp/xdebug.log"'; \ | |
echo "xdebug.remote_host=$HOST_IP"; \ | |
} > /usr/local/etc/php/conf.d/xdebug.ini |
This file contains 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 characters
# docker-compose -f docker-compose.yml -f docker-compose.xdebug.yml up | |
version: '3.2' | |
services: | |
web: | |
image: your-container:xdebug | |
build: | |
context: . | |
dockerfile: Dockerfile.xdebug | |
args: | |
HOST_IP: "${DOCKER_HOST_IP}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment