0

Info:

  • Docker version ($ docker --version): Docker version 18.06.0-ce, build 0ffa825
  • Laradock commit ($ git rev-parse HEAD): 8180804ae
  • System info (Mac, PC, Linux): macOs HighSierra 10.13.6

Issue:

Can't get Xdebug to work.


Expected behavior:

Should stop at breakpoint


Relevant Code:

laradock/.env PHP_FPM_INSTALL_XDEBUG=true WORKSPACE_INSTALL_XDEBUG=true

Content of php-fpm/xdebug.ini:

xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_connect_back=0
xdebug.cli_color=1
xdebug.profiler_enable=0
xdebug.remote_handler=dbgp
xdebug.remote_mode=req

xdebug.remote_port=9000
xdebug.remote_host=172.16.3.97
xdebug.idekey=PHPSTORM

workspace/xdebug.ini has same content as in php-fpm folder

enter image description here

ZR87
  • 1,463
  • 16
  • 27
  • Well, I never do it that way but I followed these configuration that what jetbrains says https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html .. it always work for me.. it says add above lines in php.ini file not in xdebug.ini file.. – Teoman Tıngır Aug 18 '18 at 17:51
  • 1
    1) What Xdebug log has to say? 2) Is IP address for `remote_host` is correct one? Very often it is not. Try Docker-special hostname instead. 3) You are on Mac .. which means that there is a chance that you may have php-fpm installed on Mac .. which uses 9000 port as well. Change xdebug port (in php.ini and PhpStorm) to another one (e.g. 9001 -- typical choice). P.S. xdebug is a must have -- it can give an answer or good hints straight away in some cases (if you know how to read it) – LazyOne Aug 18 '18 at 19:51
  • Good 1st hint on remote_host @LazyOne! I've just found the solution in this tutorial: https://medium.com/full-stack-development/laradock-xdebug-ms-code-no-problem-35a4338deb3f It works at last and yes, the `remote_host` was bad. Since "From Docker 18.03 onwards our recommendation is to connect to the special DNS name host.docker.internal, which resolves to the internal IP address used by the host." Thanks for dropping by! – ZR87 Aug 18 '18 at 20:08

1 Answers1

0

The problem was that I has a bad IP for remote_host So if you're on mac and you want to connect from a container to a service on the host then: "Docker v18.03 onwards our recommendation is to connect to the special DNS name host.docker.internal, which resolves to the internal IP address used by the host."

Read more here

Community
  • 1
  • 1
ZR87
  • 1,463
  • 16
  • 27