运行环境说明
启动报错信息
[error] [1]Uncaught TypeError: think\DbManager::setCache(): Argument #1 ($cache) must be of type Psr\SimpleCache\CacheInterface, think\swoole\pool\proxy\Store given, called in /var/www/html/vendor/topthink/framework/src/think/Db.php on line 38 and defined in /var/www/html/vendor/topthink/think-orm/src/DbManager.php:143
Stack trace:
#0 /var/www/html/vendor/topthink/framework/src/think/Db.php(38): think\DbManager->setCache(Object(think\swoole\pool\proxy\Store))
#1 [internal function]: think\Db::__make(Object(think\Event), Object(think\Config), Object(think\Log), Object(think\swoole\pool\Cache))
#2 /var/www/html/vendor/topthink/framework/src/think/Container.php(385): ReflectionMethod->invokeArgs(NULL, Array)
#3 /var/www/html/vendor/topthink/framework/src/think/Container.php(252): think\Container->invokeClass('think\\swoole\\po...', Array)
#4 /var/www/html/vendor/topthink/framework/src/think/Container.php(131): think\Container->make('think\\swoole\\po...')
#5 /var/www/html/vendor/topthink/framework/src/think/Container.php(513): think\Container->get('db')
#6 /var/www/html/vendor/topthink/framework/src/think/service/ModelService.php(25): think\Container->__get('db')
#7 [internal function]: think\service\ModelService->boot()
#8 /var/www/html/vendor/topthink/framework/src/think/Container.php(329): ReflectionMethod->invokeArgs(Object(think\service\ModelService), Array)
#9 /var/www/html/vendor/topthink/framework/src/think/Container.php(362): think\Container->invokeMethod('boot', Array, false)
#10 /var/www/html/vendor/topthink/framework/src/think/App.php(223): think\Container->invoke(Array)
#11 /var/www/html/vendor/topthink/framework/src/think/App.php(495): think\App->bootService(Object(think\service\ModelService))
#12 [internal function]: think\App->think\{closure}(Object(think\service\ModelService), 3)
#13 /var/www/html/vendor/topthink/framework/src/think/App.php(496): array_walk(Array, Object(Closure))
#14 /var/www/html/vendor/topthink/framework/src/think/initializer/BootService.php(24): think\App->boot()
#15 /var/www/html/vendor/topthink/framework/src/think/App.php(461): think\initializer\BootService->init(Object(think\swoole\App))
#16 /var/www/html/vendor/topthink/think-swoole/src/concerns/WithApplication.php(43): think\App->initialize()
#17 /var/www/html/vendor/topthink/think-swoole/src/concerns/InteractsWithServer.php(90): think\swoole\Manager->prepareApplication('')
#18 [internal function]: think\swoole\Manager->think\swoole\concerns\{closure}(Object(Swoole\Process\Pool), 3)
#19 {main}
thrown[/var/www/html/vendor/topthink/think-orm/src/DbManager.php:143]
解决办法,降低版本至 4.0.10
composer remove topthink/think-swoole
composer require topthink/think-swoole:4.0.10
降低版本后产生的新问题
1、用swoole端口访问静态资源 404
2、服务端出现:
WARNING Context::build_header() (ERRNO 7105): You have set 'Transfer-Encoding', 'Content-Length' will be ignored