Using XDebug and PhpStorm from a guest virtual machine through a host browser

My setup is a bit special: on the Windows 10 host, I have the Ubuntu VirtualBox guest console running. I am using an X11 redirected SSH terminal to launch PhpStorm directly at the guest and display it on my host. My web server is also located in a virtual machine, and I access it from the browsers of the host machine using a virtual host, for example, http://local.dev .

This setup works pretty nicely, which allows me to skip copying my server files to the host so that I can edit them using the host-based PhpStorm. However, I find it difficult to have XDebug run in the host browser.

The only thing I managed to debug was to add ?XDEBUG_SESSION_START at the end of the URLs that I run from my host’s browser, however this only works for checkpoints in the code just executed, and not in AJAX calls, as I get the following message PhpStorm after loading page:

16:53:02 The debugging session ended without suspension. This may be due to an incorrect route mapping configuration or not synchronized local and remote projects.

How to configure XDebug in a virtual machine to enable debugging from the host browser? I tried matching paths, but it seems to make no sense, since for PhpStorm and XDebug the files are not located on the remote host.

+5
source share

Source: https://habr.com/ru/post/1240858/


All Articles