Connection with xdebug was not established OSX Docker Follow
Answered
Hi there,
I'm struggling with getting phpstorm connected to xdebug set on docker.
Here's what i see when I php -i inside the container, also this is what I see when i do phpinfo(); I set this variable in xdebug.ini
So that indicates remote_enable is ON.
But when I try to debug I keep getting
When I click "Validate installation" it goes
And after "Show phpinfo"
100% image is correctly linked in CLI interpreters
Anything that I'm missing? Thanks for any advices!
Please sign in to leave a comment.
remote_host set to localhost is wrong. localhost here is the container's address, while you need to connect to the host machine.
Set it to the IP of en0.
If it still doesn't work after, please enable Xdebug remote log and check what's happening there.
Tried many configurations, nothing works. I enabled xdebug remote log, this is what I see there
Just to be sure - have you configured PhpStorm to listen to 9071 at Preferences | Languages & Frameworks | PHP | Debug?
Another one - is Listening for incoming connections enabled when you're trying to start a session?
OK, update
When I do `php test.php` inside container it works partially - listens for the connections
but when I just click "Debug" on the file test.php in PHPStorm - I get "Connection with xdebug was not established", same as described above
What I did - updated my xdebug.ini
/application/test.php - this is the path inside the container
> but when I just click "Debug" on the file test.php in PHPStorm
Please show a screenshot of the Run/Debug configuration you're using for this file.
> When I do `php test.php` inside container it works partially - listens for the connections
Please consider adding correct mappings at Settings | Language & Frameworks | PHP | Servers.
Run/Debug configuration is empty for this file..
There is nothing to type in in "Interpreter options"
Remote debug works now, mapping was the problem, and slight server configuration fixes. Thank you for this one!
On Mac OS X you should use:
Mac has changing internal IPs so you could create a alias, but Xdebug has recognized the problem and offers "docker.for.mac.host.internal" as a solution.