Mick
Mick

Reputation: 1561

Has anyone got Xdebug working with Laravel Octane?

We are using Laravel Octane (with Swoole) and are struggling to get Xdebug working consistently (PhpStorm and Docker). It seems to work (hits breakpoints) and then stops when we make code changes.

Is this something to do with Swoole? Do we need to be using Yet Another Swoole Debugger?

Upvotes: 1

Views: 1644

Answers (2)

Monguz
Monguz

Reputation: 11

If you use swoole, the PHP works a bit differently. I jus found this bug report, where is a suggestion: "use 'xdebug_break()'" I tested on a fresh setup (latest version of swoole and xdebug) with Laravel Octane using the watch feature. Instead of placing a break point,just call the "xdebug_break()" method. As I tested, it works well.

Using Xdebug with Swoole in PHPSTORM (image)

Upvotes: 1

Aleksander Wons
Aleksander Wons

Reputation: 3967

According to the OpenSwoole documentation, swoole is not compatible with xdebug.

Generally, PHP works in a request/response mode. All of the PHP extensions assume that this is how PHP will run. And that's not how swoole works. Apart from xdebug, more extensions will not work when you use swoole: phptrace, aop (Aspect Oriented Programming), xhprof, Phalcon, BlackFire, Datadog, Newrelic? (swoole is not on the list of officially supported web servers).

While the situation may improve over time, currently, many "low level" extensions will not be compatible with swoole.

Upvotes: 1

Related Questions