$ docker-machine upgrade <VM NAME>
$ pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug
Your ini
file is located under /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
.
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1 #Set this to 1 in order for xdebug to start when the container starts
xdebug.remote_connect_back=1 #Set this to 1 if you don't want to provide remote_host
\!h xdebug.idekey=<Unique IDE Key to be also set on PHPStorm config>
#xdebug.remote_host=<HOST LOCAL IP ADDRESS>
If you set xdebug.remote_connect_back=1
then you don’t have to provide
xdebug.remote_host=<HOST LOCAL IP ADDRESS>
but you have to enable
Start Listening for PHP Debug Connections
in PHPStorm.
Languages & Frameworks > PHP > Servers
.VM's IP address
.80
if you are not listening from any other port in your web server in VM.XDebug
.Use path mappings
.Absolute path on the server
section write where your projetc is located in your docker container. (i.e. /var/www
)Run > Edit Configurations...
.PHP Remote Debug
.Filter connection by IDE key
.IDE key
. This is the same key you have written in your XDebug.ini
file as xdebug.idekey
. These two have to match.Run > Start Listening for PHP Debug Connections
.Run > Debug
.