-
Add the following into your Dockerfile
RUN yes "" | pecl install xdebug && \ echo "zend_extension="$(find / -name xdebug.so) > /etc/php5/fpm/conf.d/xdebug.ini && \ echo "xdebug.remote_enable = on" >> /etc/php5/fpm/conf.d/xdebug.ini && \ echo "xdebug.remote_host = 10.254.254.254" >> /etc/php5/fpm/conf.d/xdebug.ini && \ echo "xdebug.remote_port = 9000" >> /etc/php5/fpm/conf.d/xdebug.ini && \ echo 'xdebug.idekey = "INTELLIJ"' >> /etc/php5/fpm/conf.d/xdebug.ini && \ echo 'xdebug.remote_log = /var/log/xdebug_remote.log' >> /etc/php5/fpm/conf.d/xdebug.ini && \ touch /var/log/xdebug_remote.log && chown www-data:www-data /var/log/xdebug_remote.log
-
Setup an alias for
localhost
on your Mac- In terminal.app run the following command:
sudo ifconfig lo0 alias 10.254.254.254
- In terminal.app run the following command:
-
Configure PHPStorm / IntelliJ Preferences
-
Press ⌘, (Command - comma) to open the Preferences pane
-
Navigate to
Languages & Frameworks
->PHP
-
If not, press the
...
button and setup an interpreter based on the PHP installation on your Mac -
Navigate to
Languages & Frameworks
->PHP
->Debug
-
Make sure these settings are checked. Note: that
Break at first line in PHP scripts
is optional -
Navigate to
Languages & Frameworks
->PHP
->Servers
-
Setup new server as shown in the screenshot below taking note to add in the mapping between your local project and the directory from the container.
-
-
Configure PHPStorm / IntelliJ Project Debug Settings
-
Click the Run/Debug Configuration dropdown button to setup a new debug config, or choose "Edit Configurations..." from the "Run" menu
-
Click the
+
button to create a new config -
Choose "PHP Remote Debug" from the dropdown menu
-
Make sure that the Server is set to the server you created in step 3
-
Make sure that the "Ide key" is set to
INTELLIJ
(or whatever you havexdebug.idekey
set to in your Dockerfile)
-
-
Make sure your Docker container is running with
docker run
ordocker-compose up -d
-
Start the debugger by pressing the green debug toolbar button or press CTRL-D
-
Submit your request, or browse to a page on localhost:8080
Last active
May 25, 2016 00:16
-
-
Save coleca/c227543fbed515e4eb4c058a7455c581 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment