How to connect PhpStorm with Xdebug

五迷三道 提交于 2020-06-16 02:53:07

问题


I hope somebody here can help me with my issue:

I recently gotten into my first PHP project and need to set up debugging. I'm aware many people had the same problem before me but I struggle to find a solution.

I need to set up PhpStorm with Xdebug and with all settings made its still not working and when I start my debug session i get stuck at this with no further information:

This is my project setup:

Docker Webapp with Xdebug: 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp

PhpStorm PHP Debug Settings:

Xdebug settings from phpinfo():

Listening to debug connections in PhpStorm is on, starting a debug session create a session via GET: https://localhost/?XDEBUG_SESSION_START=16957 but all my breakpoints are ignored.

Trying to get more information I ran netstat:

Can anyone tell me what I am missing here?

Thank you very much in advance!


回答1:


  1. Don't use run/debug configurations for web debugging, it's counter-productive. You can initiate debugging connections from the browser directly using zero-configuration debugging.
  2. Disable xdebug.remote_connect_back, it brings more harm than profit, especially with Docker.
  3. xdebug.remote_host is not supposed to be localhost when you are using Docker, this way, the container is trying to send the debug data to itself instead of the host machine. It seems that you are using macOS and Docker for Mac, the correct hostname would be host.docker.internal in such a case.
  4. If after you initiate a debugging session from the browser PhpStorm still cannot catch a connection, we'll need to take a look at the Xdebug log as @LazyOne suggested.

A blog post showing Docker in PhpStorm basics: https://blog.jetbrains.com/phpstorm/2018/08/quickstart-with-docker-in-phpstorm/



来源:https://stackoverflow.com/questions/62203607/how-to-connect-phpstorm-with-xdebug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!