![phpstorm 2019 debug php application in docker container phpstorm 2019 debug php application in docker container](https://sandro-keil.de/blog/content/images/2015/10/container.jpg)
You can use php -i inside the container, or use any other technique you want that gives the output of phpinfo(), including Drupal's admin/reports/status/php. Listening enabled, but don't get any response.Ĭheck to make sure that xdebug is enabled. If not, maybe PHPStorm is not listening, or not configured to listen on port 9000? (Note that previous instructions used a different port, if you used XDebug before v0.18.0, you might have PHPStorm set to a different port.)
![phpstorm 2019 debug php application in docker container phpstorm 2019 debug php application in docker container](https://i.stack.imgur.com/hUKfU.png)
Now click the listen button on PHPStorm to start it listening for connections.ĭdev ssh and try the telnet 9000 again. Don't continue until your telnet command does not connect. Use lsof -i :9000 -sTCP:LISTEN to find out what is there and stop it, or change the xdebug port and configure PHPStorm to use the new one. Or just exit PHPStorm.ĭdev ssh: Can telnet 9000 connect? If it does, you have something else running on port 9000, probably php-fpm. In PHPStorm, disable the "listen for connections" button so it won't listen. Can you ping (and get responses)? If you can't, you might have an over-aggressive firewall. Xdebug_enabled: true is in the config.yamlĭdev ssh into the web container. ddev/config.yaml (xdebug_enabled: true) but you can also ddev exec enable_xdebug Make sure xdebug has been enabled it's disabled by default from v0.16.0 on.
![phpstorm 2019 debug php application in docker container phpstorm 2019 debug php application in docker container](https://untoldhq.com/sites/default/files/old-blog-images/jetbrains-toolbox.png)
Slightly different names in the EAP PHPStorm I'm using but have set up as shown in the docs: Thank you.ĭone, tried both Zero and Run/Debug configuration methods. Wow, that was super fast, thank you very much! I'll try and test/confirm this weekend but failing that I'll report back on Monday from Work. I tried this and it worked out of the box. Here's a workaround for you, we'll try to solve this in a future version of ddev. Amazing that you're the first one to ever mention tripping on that. It turns out that the "" hostname is not supported in Docker Toolbox. Managed to convince myself that treating the Virtualbox like a remote machine seemed sensible enough, glad to hear that's not the case :-)īTW, before you spend more time with this: I confirm your experience. I've always used the "Zero-configuration" method in the past but after that didn't work I thought it might be something to do with having to run Docker via Virtualbox. What you're doing here is the equivalent of debugging php on a remote machine. Note that you should not have to do any configuration of your local (host) php interpreter, and PHPStorm does not need to know anything about docker. Version and configuration information (please complete the following information): The Docker server is set up to connect to the Docker default machine that is started when I open the Docker Quickstart Terminal. I’ve had a look at my PHPStorm settings to change the CLI interpreter to php 7.2 but the Docker server that it finds php 7.1 When I run the php script through PHPStorm it is running through the Docker PHP_DEFAULT_VERSION: My ddev site is using the DDEV_PHP_VERSION, when I access the URL in the web browser and check out phpinfo, I can see that it is using PHP 7.2.12 "NGINX_SITE_VARS=$WEBSERVER_DOCROOT,$NGINX_DOCROOT", "COMPOSER_CACHE_DIR=/mnt/composer_cache", Running docker inspect ddev-bit-website-web I can see that: Turn on listening in PHPStorm, add a breakpoint and the script pauses when I access my Reload the page, PHPStorm doesn't point.Create a test script, add a breakpoint in PHPStorm.Website is now accessible in the browser. (Maybe not but I don’t have any better ideas what might be stopping it from listening!) I feel like if I can get PHPStorm to listen to ddev’s php 7.2 instead of Docker’s php 7.1 then xdebug will start working. (I think this is what's causing xdebug not to work, if I'm completely off base please let me know). The part I’m struggling with is getting PHPStorm to listen to the correct version of PHP. I’ve got the website running locally through ddev, that all works fine.
![phpstorm 2019 debug php application in docker container phpstorm 2019 debug php application in docker container](https://i.stack.imgur.com/eLArQ.png)
PHPSTORM 2019 DEBUG PHP APPLICATION IN DOCKER CONTAINER WINDOWS 10
I’m trying to set up xdebug with PHPStorm and ddev on Windows 10 home using Docker Toolbox.