Skip to content

[Bug]: Class "Swoole\Process" not found when using FrankenPHP #2

@eleftrik

Description

@eleftrik

What happened?

I'm using Laravel Octane with FrankenPHP in a Laravel 12 application.
In my HealthServiceProvider I added OctaneCheck::new().

When I run php artisan health:check, I got

  Class "Swoole\Process" not found

  at vendor/laravel/octane/src/Swoole/SwooleExtension.php:22
     18▕      * Send a signal to the given process.
     19▕      */
     20▕     public function dispatchProcessSignal(int $processId, int $signal): bool
     21▕     {
  ➜  22▕         if (Process::kill($processId, 0)) {
     23▕             return Process::kill($processId, $signal);
     24▕         }
     25▕
     26▕         return false;

  1   vendor/laravel/octane/src/Swoole/SignalDispatcher.php:48
      Laravel\Octane\Swoole\SwooleExtension::dispatchProcessSignal()

  2   vendor/laravel/octane/src/Swoole/SignalDispatcher.php:16
      Laravel\Octane\Swoole\SignalDispatcher::signal()

  3   vendor/laravel/octane/src/Swoole/ServerProcessInspector.php:29
      Laravel\Octane\Swoole\SignalDispatcher::canCommunicateWith()

  4   vendor/ahtinurme/octane-health-check/src/OctaneCheck.php:53
      Laravel\Octane\Swoole\ServerProcessInspector::serverIsRunning()

  5   vendor/ahtinurme/octane-health-check/src/OctaneCheck.php:24
      Ahtinurme\OctaneCheck::isSwooleServerRunning()

If I use OctaneCheck::new()->setServer('frankenphp') and run health command again, I always got OK, it doesn't matter if Octane is running or not.
In this case, it seems $isRunning is evaluated as true, because invalidServer() returns a Result, so the variable is not falsy.

I think I can send a PR to fix this.

How to reproduce the bug

Install Octane, set OCTANE_SERVER="frankenphp" in .env, configure health checks and run php artisan health:check

Package Version

2.0.0

PHP Version

8.4.0

Laravel Version

12.0.0

Which operating systems does with happen with?

No response

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions