Skip to content

Instantly share code, notes, and snippets.

@GSmurf
Forked from chadrien/README.md
Created April 7, 2017 13:08
Show Gist options
  • Save GSmurf/917cd4331e5cee294f877e64e66b0ff8 to your computer and use it in GitHub Desktop.
Save GSmurf/917cd4331e5cee294f877e64e66b0ff8 to your computer and use it in GitHub Desktop.

Revisions

  1. @chadrien chadrien revised this gist Aug 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@
    * `Host`: your IP address
    * `Port`: 9000

    Then you're all set and can start listening PHP Debug connections from your IDE. On the first run it will ask you to map
    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!
  2. @chadrien chadrien revised this gist Aug 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@
    && 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
    ```
    2. Get you local IP address
    2. Get you local IP address (`ifconfig` or such)
    3. 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`:
  3. @chadrien chadrien revised this gist Aug 28, 2015. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,6 @@
    4. In Intellij/PHPStorm go to: `Languages & Frameworks` > `PHP` > `Debug` > `DBGp Proxy` and set the following settings:
    * `Host`: your IP address
    * `Port`: 9000
    *

    Then you're all set and can start listening 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!
  4. @chadrien chadrien revised this gist Aug 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@
    ```
    2. Get you local IP address
    3. 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`
    * Simple `docker` run: `docker run -e XDEBUG_CONFIG="remote_host={{YOUR_IP_ADDRESS}}" your-image`
    * With `docker-compose`:

    ```yaml
  5. @chadrien chadrien revised this gist Aug 28, 2015. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -9,8 +9,7 @@
    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 \
    && echo "xdebug.max_nesting_level=500" >> /usr/local/etc/php/conf.d/xdebug.ini
    && echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
    ```
    2. Get you local IP address
    3. Start your container with the following environment variable: `XDEBUG_CONFIG="remote_host={{YOUR_IP_ADDRESS}}"`
  6. @chadrien chadrien revised this gist Aug 28, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,7 @@
    3. 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`:

    ```yaml
    # docker-compose.yml
    foo:
  7. @chadrien chadrien created this gist Aug 28, 2015.
    34 changes: 34 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    # Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

    1. For your local dev, create a `Dockerfile` that is based on your production image and
    simply install `xdebug` 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 \
    && echo "xdebug.max_nesting_level=500" >> /usr/local/etc/php/conf.d/xdebug.ini
    ```
    2. Get you local IP address
    3. 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`:
    ```yaml
    # docker-compose.yml
    foo:
    build: path/to/Dockerfile
    environment:
    XDEBUG_CONFIG: remote_host={{YOUR_IP_ADDRESS}}
    ```
    4. In Intellij/PHPStorm go to: `Languages & Frameworks` > `PHP` > `Debug` > `DBGp Proxy` and set the following settings:
    * `Host`: your IP address
    * `Port`: 9000
    *

    Then you're all set and can start listening 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!