mochat icon indicating copy to clipboard operation
mochat copied to clipboard

初始化项目报错 php bin/hyperf.php mc:init 报错 PHP Fatal error: Uncaught Error: Class 'Swoole\Coroutine' not found in /www/wwwroot/mochat/api-server/vendor/hyperf/engine/src/Coroutine.php:60

Open EnterpriseSolution opened this issue 3 years ago • 2 comments

我用的环境

  • PHP 版本:7.4
  • MoChat 版本:最新版,2022.2.15获取(git clone)
  • Swoole 版本:4

问题及现象

执行项目初始化时,报错,

php bin/hyperf.php mc:init

PHP Warning: Use of undefined constant SWOOLE_HOOK_ALL - assumed 'SWOOLE_HOOK_ALL' (this will throw an Error in a future version of PHP) in /www/wwwroot/mochat/api-server/bin/hyperf.php on line 12

Warning: Use of undefined constant SWOOLE_HOOK_ALL - assumed 'SWOOLE_HOOK_ALL' (this will throw an Error in a future version of PHP) in /www/wwwroot/mochat/api-server/bin/hyperf.php on line 12 PHP Warning: Use of undefined constant SWOOLE_HOOK_CURL - assumed 'SWOOLE_HOOK_CURL' (this will throw an Error in a future version of PHP) in /www/wwwroot/mochat/api-server/bin/hyperf.php on line 12

Warning: Use of undefined constant SWOOLE_HOOK_CURL - assumed 'SWOOLE_HOOK_CURL' (this will throw an Error in a future version of PHP) in /www/wwwroot/mochat/api-server/bin/hyperf.php on line 12

PHP Fatal error: Uncaught Error: Class 'Swoole\Coroutine' not found in /www/wwwroot/mochat/api-server/vendor/hyperf/engine/src/Coroutine.php:60 Stack trace: #0 /www/wwwroot/mochat/api-server/vendor/hyperf/utils/src/Coroutine.php(90): Hyperf\Engine\Coroutine::id() #1 /www/wwwroot/mochat/api-server/vendor/hyperf/utils/src/Context.php(41): Hyperf\Utils\Coroutine::inCoroutine() #2 /www/wwwroot/mochat/api-server/vendor/hyperf/utils/src/Context.php(76): Hyperf\Utils\Context::has() #3 /www/wwwroot/mochat/api-server/vendor/hyperf/di/src/Resolver/DepthGuard.php(59): Hyperf\Utils\Context::override() #4 /www/wwwroot/mochat/api-server/vendor/hyperf/di/src/Resolver/DepthGuard.php(72): Hyperf\Di\Resolver\DepthGuard->increment() #5 /www/wwwroot/mochat/api-server/vendor/hyperf/di/src/Resolver/ResolverDispatcher.php(63): Hyperf\Di\Resolver\DepthGuard->call() #6 /www/wwwroot/mochat/api-server/vendor/hyperf/di/src/Container.php(184): Hyperf\Di\Resolver\ResolverDispatcher->resolve() #7 /www/wwwroot/mochat/api-server/vendor/hyperf/di/src/Containe in /www/wwwroot/mochat/api-server/vendor/hyperf/engine/src/Coroutine.php on line 60

Fatal error: Uncaught Error: Class 'Swoole\Coroutine' not found in /www/wwwroot/mochat/api-server/vendor/hyperf/engine/src/Coroutine.php:60 Stack trace: #0 /www/wwwroot/mochat/api-server/vendor/hyperf/utils/src/Coroutine.php(90): Hyperf\Engine\Coroutine::id() #1 /www/wwwroot/mochat/api-server/vendor/hyperf/utils/src/Context.php(41): Hyperf\Utils\Coroutine::inCoroutine() #2 /www/wwwroot/mochat/api-server/vendor/hyperf/utils/src/Context.php(76): Hyperf\Utils\Context::has() #3 /www/wwwroot/mochat/api-server/vendor/hyperf/di/src/Resolver/DepthGuard.php(59): Hyperf\Utils\Context::override() #4 /www/wwwroot/mochat/api-server/vendor/hyperf/di/src/Resolver/DepthGuard.php(72): Hyperf\Di\Resolver\DepthGuard->increment() #5 /www/wwwroot/mochat/api-server/vendor/hyperf/di/src/Resolver/ResolverDispatcher.php(63): Hyperf\Di\Resolver\DepthGuard->call() #6 /www/wwwroot/mochat/api-server/vendor/hyperf/di/src/Container.php(184): Hyperf\Di\Resolver\ResolverDispatcher->resolve() #7 /www/wwwroot/mochat/api-server/vendor/hyperf/di/src/Containe in /www/wwwroot/mochat/api-server/vendor/hyperf/engine/src/Coroutine.php on line 60

多次检查,api-server目录下并无vendor文件夾和子文件。

EnterpriseSolution avatar Feb 16 '22 02:02 EnterpriseSolution

php --ri swoole 看下swoole扩展装了吗

songhui678 avatar Mar 08 '22 09:03 songhui678

我也报错这个问题 都不知道哪里出现问题,拓展装了的

dwm97317 avatar Apr 28 '22 05:04 dwm97317

image

同样的问题

tianwen20 avatar Sep 27 '22 06:09 tianwen20

同样的问题

tianwen20 avatar Sep 27 '22 06:09 tianwen20

未安装扩展,或扩展未安装在当前版本的PHP中

maxincai avatar Sep 27 '22 06:09 maxincai