-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XDebug not working in PHPstorm on Windows #86
Comments
Just guessing but the xdebug install part mentions port 9001 but it's neither exposed in the Dockerfile nor in the docker-compose.yml so try adding
to the php service in docker-compose.yml |
Hi, Under OS X it does not work either. Maybe I am missing something? I have tried changing the port to 9002, both in IDE and php configuration, just in case, but it still does not work. Is there any special PHPStorm configuration that needs to be done? Thank you. |
I'm trying to making it work since 3 days, If you set the port binding, you'll be unable to listen it with phpstorm, so unfortunately the solution of @Selion05 doesn't work. I have set a bunch of options into xdebug, and i'm now inserting a xdebug.ini in the container. Here is a sample of the file : zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9001
xdebug.remote_autostart=1
xdebug.remote_connect_back=0
xdebug.idekey=PHPSTORM
xdebug.remote_host=172.17.133.129
xdebug.remote_log = "/var/www/symfony/var/logs/xdebug.log" In these file you'll find two interesting lines :
after tailing the log, i've finally found out that the problem was coming from the connection was this one :
Here is my docker-compose.yml : php:
build:
context: php7-fpm
args:
TIMEZONE: ${TIMEZONE}
volumes:
- ${SYMFONY_APP_PATH}:/var/www/symfony
- ./logs/symfony:/var/www/symfony/var/logs
- ${SYMFONY_APP_PATH}:/var/www/symfony/var/logs
environment:
XDEBUG_CONFIG: "remote_host=172.17.133.129"
expose:
- "9000"
- "9001"
extra_hosts:
- "dockerhost:172.17.133.129" So, the problem seems to come from the php container who is unable to connect to the host machine... But can't make it work :/ |
I got it working now on Windows. Xdebug in the PHP-FPM container was unable to send traffic back to the host. In other words, the IP that Here is my Dockerfile, note that I added phpcs to it at the end:
I do see warnings that I haven't been able to solve yet though: 'cannot load Xdebug because it was already loaded'. If anyone knows what that's all about, give a shout. docker-compose.yml (ports untouched, listening on 9000 in PHPSTORM):
|
Thank you @progonkpa I'll test that later today :) |
Okay, so after testing it, it is possible to integrate the xdebug way with the PR #81 The fact that there is a fast_cgi config make it possible here is my config : # See https://github.com/docker-library/php/blob/master/7.1/fpm/Dockerfile
FROM php:7.1-fpm
ARG TIMEZONE
MAINTAINER Maxence POUTORD <[email protected]>
RUN apt-get update && apt-get install -y \
openssl \
git \
unzip \
libpng-dev \
g++ \
libicu-dev \
libxslt-dev
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer --version
# Set timezone
RUN ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && echo ${TIMEZONE} > /etc/timezone
RUN printf '[PHP]\ndate.timezone = "%s"\n', ${TIMEZONE} > /usr/local/etc/php/conf.d/tzone.ini
RUN "date"
# Type docker-php-ext-install to see available extensions
RUN docker-php-ext-install pdo pdo_mysql gd exif opcache && docker-php-ext-enable opcache
# install xdebug
RUN pecl install xdebug
RUN docker-php-ext-enable xdebug
RUN echo 'memory_limit = 1024M' >> /usr/local/etc/php/conf.d/memory-limit-php.ini
RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl
RUN docker-php-ext-configure xsl
RUN docker-php-ext-install xsl
#RUN sed -i 's/memory_limit = .*/memory_limit = '1024M'/' /etc/php/cli/php.ini
COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "\rxdebug.remote_host=docker.for.win.localhost" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo 'alias sf="php bin/console"' >> ~/.bashrc
WORKDIR /var/www/symfony my xdebug.ini zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9001
xdebug.remote_autostart=1
xdebug.remote_connect_back=0
xdebug.idekey=PHPSTORM
xdebug.remote_log = "/var/www/symfony/var/logs/xdebug.log" My container : php:
build:
context: php7-fpm
args:
TIMEZONE: ${TIMEZONE}
volumes:
- ${SYMFONY_APP_PATH}:/var/www/symfony
- ./logs/symfony:/var/www/symfony/var/logs
- ${SYMFONY_APP_PATH}:/var/www/symfony/var/logs
expose:
- "9000"
- "9001" My config in phpstorm : |
This probably isn't a real issue but I don't get XDebug to work on my machine. Can anyone point at a good tutorial or give some pointers?
The text was updated successfully, but these errors were encountered: