1

I'm running PhpStorm on Ubuntu 16.04 and trying to configure Xdebug to work with Docker. And I followed this guide:

Zero-configuration Web Application Debugging with Xdebug and PhpStorm

Here's step I did:

Download the Docker Xdebug project source code provided by JetBrains

Edit Xdebug remote host:

Edit Xdebug remote host

Configure DBGp Proxy (under Language & Framework => PHP => Xdebug) as following:

DBGp Proxy

Edit Run/Debug Configuration

Run/Debug Configuration

Run/Debug Configuration

Edit Build, Execution, Deployment for Docker

Build, Execution, Deployment

Start Docker

Start Docker

Enable Listening Xdebug Connection

Listening Xdebug Connection

Check Xdebug info

Xdebug info

But somehow, I cannot start the Xdebug button (as you can see in the above photo).

What did I do wrong?

6
  • Well .. you have started the Docker container. Now you need to launch your web app and tell xdebug that you want to debug it. This can be done via specific [bookmarklet ](jetbrains.com/phpstorm/marklets) or via xdebug extension for your browser -- either of them will set the xdebug cookie .. so when you reload the page (or click any other link/button on that page so it will load other URL) it will send that cookie to xdebug. Commented Sep 12, 2016 at 8:36
  • P.S. I'm not sure about the need to map 9000 port in docker as it's xdebug that connects to PhpStorm and not other way around. You may also enable collecting xdebug logs to see what's going on from xdebug side: xdebug.org/docs/all_settings#remote_log Commented Sep 12, 2016 at 8:38
  • Try to add query paramter "XDEBUG_SESSION_START=PHPSTORM" to the URL but not work. Plus, I can even click the debug button. Commented Sep 12, 2016 at 9:44
  • You cannot click the debug button (as per your 2nd from last screenshot) because that's for launching Docker only (which in general can be used with any technology: PHP, Ruby, Python, Java ect). For PHP debugging you may create and use "Web App" type of configuration (use it after Docker was launched) or via bookmarklet/extension (like original manual from PhpStorm site is suggesting). Commented Sep 12, 2016 at 9:58
  • You may also just use xdebug.remote_autostart = on to tell xdebug that it needs to debug every single request (in case if you cannot make it work via xdebug cookie/query parameter). Commented Sep 12, 2016 at 10:00

1 Answer 1

4

Somehow the docker container cannot access port 9000 on host machine. By running the following command I fixed the problem:

# iptables -I INPUT -p tcp -m tcp --dport 9000 -j ACCEPT
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, saved me couple of hours. :) I ended up using ufw instead though -sudo ufw allow 9000/tcp comment 'xdebug'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.