4

I already have a project running on Laravel Sail 10.0 with roadrunner. I tried to configure Xdebug but I can't make it stop on my breakpoints. Every time I run sail up it PhpStorm create a new tab on debug section called Artisan an a lot of roadrunner-worker tabs

  • Laravel octane Sail 10.0 with roadrunner
  • Using PHP 8.2
  • Macbook Pro M1
  • PhpStorm 2022.2.5

.env

SAIL_XDEBUG_MODE=develop,debug
SAIL_XDEBUG_CONFIG="client_host=host.docker.internal client_port=9003 idekey=PHPSTORM"

PhpStorm Debug config:

enter image description here

PhpStorm Servers:

enter image description here

php.ini (maybe this is not necessary?)

enter image description here

PhpStorm debug tabs:

enter image description here

When I run sail test

Image when I run "sail test"

I tried several SAIL_XDEBUG_CONFIG

SAIL_XDEBUG_CONFIG=docker.for.mac.host.internal
SAIL_XDEBUG_CONFIG="client_host=172.30.0.1"
SAIL_XDEBUG_CONFIG="client_host=host.docker.internal client_port=9003 idekey=PHPSTORM"
SAIL_XDEBUG_CONFIG="client_host=docker.for.mac.host.internal client_port=9003 idekey=PHPSTORM"
SAIL_XDEBUG_CONFIG="client_host=docker.for.mac.host.internal remote_port=9003 remote_enable=1"
SAIL_XDEBUG_CONFIG="remote_host=host.docker.internal remote_port=9003 idekey=PHPSTORM"
SAIL_XDEBUG_CONFIG="remote_host=host.docker.internal remote_port=9003 idekey=PHPSTORM"
4
  • I don't think you're supposed to put that long config line in 1 variable. Check this link first. medium.com/codex/laravel-8-0-sail-xdebug-phpstorm-5cc900e96da4 also: set up your docker settings in your PHPStorn Commented Apr 18, 2023 at 2:39
  • 1
    Reading that post I figured out that I missed the "PHP_IDE_CONFIG: serverName=Docker" on my docker-compose.yml file. Now It's almost working but after 30 secs the xdebug session ends up. Looks like It create a new roadrunner-worker. Thanks @UnderDog Commented Apr 18, 2023 at 15:32
  • what is a roadrunner-worker? Commented Apr 18, 2023 at 17:54
  • 1
    RoadRunner is a high-performance PHP application server, load-balancer, and process manager Commented Apr 18, 2023 at 20:12

2 Answers 2

0

When xDebug triggers without pointing to the right file, usually path mappings are not well configured, or not configured at all.

From your screenshots, I can see that the path is missing a leading slash:

var/www/html should be /var/www/html instead.

Also:

  1. Ensure Remote interpreter is selected, and pointing to the right interpreter inside "Composer" settings
  2. SAIL_XDEBUG_CONFIG="client_host=host.docker.internal idekey=PHPSTORM": no need to set again the port, 9003 is the default value in xDebug v3

It should work fine now, but if it doesn't, try this:

  • In "PHP > Servers":

    • Name: the container name (usually it's laravel.test with the default sail configuration. You can use docker compose exec <tab> and use the name that points to the php container, if not sure)
    • Host: localhost
  • Ensure phpStorm is listening for XDebug connections: phpstorm listen for xdebug button, if the button has a red X, then you need to enable it (this is a good way to ignore xDebug by the way)

  • There's a nice tool you can use to see what's wrong(select local server, then add /public to the local path): phpstorm check xdebug config menu

This is basically my checklist, I don't know if the server name part is required, but I used that in other non-laravel projects, so I kept the habit for superstition, xDebug can be a bad beast sometimes. 😊

Sign up to request clarification or add additional context in comments.

Comments

0

enter image description here

enter image description here

enter image description here

Need add Remote CLI Interpreter

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.