Run Xdebug on Laravel 8 with Sail & PhpStorm on Ubuntu

I have Ubuntu 18.04 and a fresh installation of Laravel 8. I want to use Xdebug together with Sail. I followed the instructions as follows:

  1. Added SAIL_XDEBUG_MODE=develop,debug to env
  2. Run sail build --no-cache and sail up -d
  3. Run docker inspect -f {{range.NetworkSettings.Networks}}{{.Gateway}}{{end}} <container-name> to get the IP of my docker container
  4. Added SAIL_XDEBUG_CONFIG="client_host=" to env (IP from step 3)

Next I continued with the instruction from PhpStorm for debugging:

  1. Validated that Xdebug is active by sail php -v.
  2. Enabled listening to debug connection in PhpStorm
  3. Set a breakpoint and also enabled Break at first line in PHP scripts
  4. Installed Xdebug Helper browser extension for Chrome
  5. Clicked on debug in extension (bug is now green)
  6. Refresh page, page builds very slowly, but loads completely (which should not be the case, it should hang on a breakpoint)

If I switch to PhpStorm, then no dialog pops up. However, according to the instructions, there should be some instructions.

Reload the page in the browser and return to PhpStorm. In the Incoming
Connection From dialog, select the path mappings so
that PhpStorm can map the remote files on the web server to the local
files in your project.

Hera are my debug settings:
Run Xdebug on Laravel 8 with Sail & PhpStorm on Ubuntu

What am I missing?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Thanks to the helps of @LazyOne I got it working. I just had to skip step 3 & 4 in my instructions.

Or in other words, I had to follow the instructions of but ignore the Linux Host IP Configuration section, although I am on Linux. Looks like this section is not appropriate for Ubuntu?

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x