I have the following Dockerfile:
FROM php:7.0-fpm-alpine
RUN apk add --update --virtual build_deps gcc g++ autoconf make &&
docker-php-source extract &&
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=0" >> /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_handler = dbgp" >> /usr/local/etc/php/conf.d/xdebug.ini &&
echo "xdebug.remote_mode = req" >> /usr/local/etc/php/conf.d/xdebug.ini &&
docker-php-ext-enable xdebug &&
docker-php-source delete &&
apk del build_deps &&
rm -rf /var/cache/apk/* &&
rm -rf /tmp/*
ENTRYPOINT ["php-fpm"]
And I run it with the following docker-compose.yml
:
version: '2'
services:
nginx_dev:
image: nginx:alpine
ports:
- "5092:5092"
links:
- "my_symfony_www_dev"
volumes:
- './conf/nginx/nginx_dev.conf:/etc/nginx/nginx.conf:ro'
- './logs/dev:/var/logs'
volumes_from:
- 'my_symfony_www_dev'
my_symfony_www_dev:
build:
context: .
dockerfile: Dockerfile_dev
image: "myimage/my_symfony_app:dev_php"
volumes:
- "$SOURCE_PATH:/var/www/html:Z"
environment:
- PHP_IDE_CONFIG= "serverName=my_symfony_www_dev"
- XDEBUG_CONFIG="remote_host=10.254.254.254,remote_port=9080"
- PHP_XDEBUG_ENABLED=1
Also as seen there I run:
sudo ip addr add 10.254.254.254/24 brd + dev enp4s0 label enp4s0:1
And configured the PhpStorm IDE like that:
Then in Firefox I press the button and in PhpStorm I press the button I set a breakpoint over the app_dev.php
and nothing happens.
My system listens over the port 9080
via netstat -ntlp
command where the PhpStorm listens to (PhpStorm is a server according to that answer).
tcp 0 0 0.0.0.0:9080 0.0.0.0:* LISTEN 4773/java
Do you have any idea on why that happens and how to fix it?
Edit 1:
The phpinfo()
shows:
I've also set de cocker-compose.yml as:
version: '2'
services:
nginx_dev:
image: nginx:alpine
ports:
- "5092:5092"
links:
- "my_symfony_www_dev"
volumes:
- './conf/nginx/nginx_dev.conf:/etc/nginx/nginx.conf:ro'
- './logs/dev:/var/logs'
volumes_from:
- 'my_symfony_www_dev'
my_symfony_www_dev:
build:
context: .
dockerfile: Dockerfile_dev
image: "myimage/my_symfony_app:dev_php"
volumes:
- "$SOURCE_PATH:/var/www/html:Z"
environment:
- XDEBUG_CONFIG="remote_host=10.254.254.254,remote_port=9080"
- PHP_XDEBUG_ENABLED=1
And my dockerfile is:
FROM php:7.0-fpm-alpine
RUN apk add --update --virtual build_deps gcc g++ autoconf make &&
docker-php-source extract &&
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=0" >> /usr/local/etc/php/conf.d/xdebug.ini &&
echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/xdebug.ini &&
echo "xdebug.remote_handler = dbgp" >> /usr/local/etc/php/conf.d/xdebug.ini &&
echo "xdebug.remote_mode = req" >> /usr/local/etc/php/conf.d/xdebug.ini &&
docker-php-ext-enable xdebug &&
docker-php-source delete &&
apk del build_deps &&
rm -rf /var/cache/apk/* &&
rm -rf /tmp/*
ENTRYPOINT ["php-fpm"]
Still Same result.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…