ojoma
ojoma

Reputation: 59

PhpStorm with Docker + xdebug does not stop on breakpoint

I'm having trouble trying to get Xdebug to work in PhpStorm with Docker.

Here is my xdebug config:

zend_extension=xdebug.so
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.idekey="PHPSTORM"
xdebug.remote_host=192.168.0.27

My docker-compose:

version: '2.0'

services:db:

 image: mysql:5.5
 container_name: mysql5
 volumes:
   - "/home/xxx/docker_projects/mysql55_storage:/var/lib/mysql"

 ports:
   - "3355:3306"
 restart: always
 environment:
   MYSQL_ROOT_PASSWORD: pass


php510:

 build: /home/xxx/docker_projects/php510
 container_name: php510

 ports:
   - "5510:80"
 volumes:
     - "/home/xxx/www/docker_stuff/hrm32:/app"
     - "/home/xxx/docker_projects/xdebug:/etc/php5/fpm/conf.d/20-xdebug.ini"

 depends_on:
   - db

 links:
   - db

 restart: always


phpmyadmin:
 depends_on:
   - db
 image: phpmyadmin/phpmyadmin:latest
 container_name: phpmyadmin2
 links:
   - db
 ports:

I have configured my PhpStorm as follows:

PhpStorm xdebug setting

Remote debug configuration:

Remote config

When I start to debug, I only see "Waiting for incoming connection with ide key 'PHPSTORM'" and noting! What else do I need to configure? I'm running PhpStorm 2017.2 on Ubuntu 16.04

Xdebug log:

<- breakpoint_set -i 20 -t line -f file:///app/application/modules/default/forms/employee.php -n 519
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="20" id="1240039"></response>

 <- stack_get -i 21
 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="21"><stack where="{main}" level="0" type="file" filename="file:///app/index.php" lineno="21"></stack></response>

 <- run -i 22
 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="22" status="stopping" reason="ok"></response>

Upvotes: 1

Views: 2819

Answers (3)

craastad
craastad

Reputation: 6482

I had the same issue with IntelliJ Ultimate edition 2018. Upgrading IntelliJ to 2019 version fixed the issue documented in Jetbrains Issue WI-43622. If you look in the IntelliJ logs Help >> Show Log in Finder and see the exception:

XdebugDriver.onBreak must not be null 
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'remoteFileUrl' of com/jetbrains/php/debug/xdebug/debugger/XdebugDriver.onBreak must not be null

Then upgrading will fix the issue. IntelliJ and PhpStorm use the same codebase, so this should fix the issue.

Upvotes: 1

Onshop
Onshop

Reputation: 3095

Several things you can try if you Xdebug was working and has stopped working:

  • docker-compose down and then up your docker containers
  • Restart PHPStorm
  • Have you changed network? You may have a different IP address and my need to re-generate host file entries or environmental variables with the new IP address.

Upvotes: 2

ojoma
ojoma

Reputation: 59

For any one having similar issues,the following link Xdebug with phpstorm and Docker will help you configure xdebug with PHPStorm. I had to change: xdebug.remote_connect_back=0 to xdebug.remote_connect_back=1. xdebug.remote_host=??? is the ip of your host machine.

If the configuration is alright, ensure that only one IDE is configured to use xdebug for the app per instance. I noticed that, it was the cause of my issues. I simulated it a multiple times now and it's the same result.

Upvotes: 3

Related Questions