hhxsv5 / laravel-s

LaravelS is an out-of-the-box adapter between Laravel/Lumen and Swoole.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undefined constant SWOOLE_VERSION

midblep opened this issue · comments

commented

Software version (Screenshot of your startup):

| Software | Version |
| --------- | --------- |
| PHP | 8.1.7 |
| Swoole | OpenSwoole version 22.0.0 |
| Laravel/Lumen | Laravel 9.19 |

Detail description about this issue(error/log):
Fresh Laravel 9 install and OpenSwoole install with PECL and enabled via phpenmod, following install instructions from readme, then run php bin/laravels start, won't start and gives error:

php bin/laravels start                          17:52:22 
 _                               _  _____
| |                             | |/ ____|
| |     __ _ _ __ __ ___   _____| | (___
| |    / _` | '__/ _` \ \ / / _ \ |\___ \
| |___| (_| | | | (_| |\ V /  __/ |____) |
|______\__,_|_|  \__,_| \_/ \___|_|_____/

Speed up your Laravel/Lumen
>>> Components

   Error 

  Undefined constant "Hhxsv5\LaravelS\Illuminate\SWOOLE_VERSION"

  at vendor/hhxsv5/laravel-s/src/Illuminate/LaravelSCommand.php:108
    104▕                 PHP_VERSION,
    105▕             ],
    106▕             [
    107▕                 extension_loaded('openswoole') ? 'Open Swoole' : 'Swoole',
  ➜ 108▕                 SWOOLE_VERSION,
    109▕             ],
    110▕             [
    111▕                 'LaravelS',
    112▕                 $laravelSVersion,

      +15 vendor frames 
  16  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

Editing SWOOLE_VERSION to be swoole_version() makes it start fine initially. But obviously, this constant is used in a lot of places, and so it crashes later on instead.

Support Open Swoole 4.x only.