- For your local dev, create a
Dockerfile
that is based on your production image and simply installxdebug
into it. Exemple:
FROM php:5
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=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
- Get you local IP address (
ifconfig
or such) - Start your container with the following environment variable:
XDEBUG_CONFIG="remote_host={{YOUR_IP_ADDRESS}}"
-
Simple
docker
run:docker run -e XDEBUG_CONFIG="remote_host={{YOUR_IP_ADDRESS}}" your-image
-
With
docker-compose
:# docker-compose.yml foo: build: path/to/Dockerfile environment: XDEBUG_CONFIG: remote_host={{YOUR_IP_ADDRESS}}
- In Intellij/PHPStorm go to:
Languages & Frameworks
>PHP
>Debug
>DBGp Proxy
and set the following settings:
Host
: your IP addressPort
: 9000
Then you're all set and can start listening for PHP Debug connections from your IDE. On the first run it will ask you to map
your local directoryies to the docker
directories, but after that nothing will be required anymore!
Happy debugging!
Found what fixes the problem: nerves-project/nerves#112
Adding
RUN apt-get update && apt-get -y install locales
before
RUN locale-gen en_US.UTF-8
But now getting anotehr error:
Update:
Found that start-container is a file. And thought it has to have ending .sh but its the opposite - it had not to have .sh ending. So after fixing this, it built.