Skip to content

Instantly share code, notes, and snippets.

@prestontighe
Last active July 11, 2017 18:16
Show Gist options
  • Save prestontighe/4639f4e33ad52c692876a89df89e2b40 to your computer and use it in GitHub Desktop.
Save prestontighe/4639f4e33ad52c692876a89df89e2b40 to your computer and use it in GitHub Desktop.
XDebug Docker Issue. The Dockerfile is used in the `toozick/smu-arcade-machine-management-console-php-apache:v1` image. Everything with our setup works except XDebug. What could the problem be?

Here we are connecting to the host, but this is when I have "9000:9000" under ports in the php-apache service.

connecting

When I remove this line (- "9000:9000") and start listening in PHPStorm, it can find the same IP and port but it can't connect.

version: '2'
services:
ember:
container_name: ember
build:
context: .
dockerfile: docker_files/Dockerfile-dev
ports:
- "4200:4200"
- "35729:35729"
volumes:
- ./ember-app:/var/www/html/ember-app
- /var/www/html/ember-app/node_modules
- /var/www/html/ember-app/bower_components
php-apache:
container_name: php-apache
image: toozick/smu-arcade-machine-management-console-php-apache:v1
links:
- mysql
ports:
- "8080:80"
- "9000:9000"
volumes:
- .:/var/www/html/
environment:
PHP_IDE_CONFIG: application
mysql:
container_name: mysql
image: mysql:5.5
ports:
- "3306:3306"
environment:
MYSQL_USER: admin
MYSQL_ROOT_PASSWORD: 8043v36m807c3084m6m03v
MYSQL_PASSWORD: 8043v36m807c3084m6m03v
MYSQL_DATABASE: SMUAdminConsole
# FROM debian:jessie
FROM php:5.6-apache
MAINTAINER Preston Tighe
## Install
RUN apt-get update
# Apache server name
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
# Vim
RUN apt-get -y install vim wget git
COPY docker_files/php-apache/vimrc.local /etc/vim/vimrc.local
# Apache mods
RUN a2enmod rewrite
RUN a2enmod headers
RUN a2enmod ssl
# Apache config
COPY docker_files/php-apache/apache_default /etc/apache2/sites-available/default
# PHP config
#RUN sed -ri -e "s/^upload_max_filesize.*/upload_max_filesize = 10M/" \
# -e "s/^post_max_size.*/post_max_size = 10M/" /etc/php5/apache2/php.ini
# PHP package manager
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
# XDebug
WORKDIR /tmp
RUN wget http://xdebug.org/files/xdebug-2.4.1.tgz
RUN tar -xvzf xdebug-2.4.1.tgz
WORKDIR xdebug-2.4.1
RUN phpize
RUN ./configure
RUN make
RUN cp modules/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226
COPY docker_files/php-apache/xdebug.ini /usr/local/etc/php/php.ini
RUN touch /var/log/xdebug.log
RUN chown www-data:www-data /var/log/xdebug.log
RUN chmod 777 /var/log/xdebug.log
EXPOSE 9000
WORKDIR /var/www/html
# Here is my xdebug.ini that gets written to /usr/local/etc/php/php.ini
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.scream=1
xdebug.cli_color=1
xdebug.show_local_vars=1
xdebug.idekey= PHPSTORM
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_log=/var/log/xdebug.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment