Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php8.1.20、thinkphp6.1.3、swoole-ext5.1.0、think-swooole4.0.12启动报错 #362

Closed
w263756314 opened this issue Dec 21, 2023 · 3 comments

Comments

@w263756314
Copy link

w263756314 commented Dec 21, 2023

使用环境

图片
图片
图片
图片

报错信息

图片

[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]
@taozhipeng1990
Copy link

用tp最好是把版本写死。包括小版本号。composer update一次,死一次。
我也是这种情况。回退到4.0.11都每用。回退到4.0.10又一堆库被更新了,导致无法回退。要强行回退所有相关包版本。
composer require topthink/think-swoole:4.0.10 --with-all-dependencies

@w263756314
Copy link
Author

用tp最好是把版本写死。包括小版本号。composer update一次,死一次。 我也是这种情况。回退到4.0.11都每用。回退到4.0.10又一堆库被更新了,导致无法回退。要强行回退所有相关包版本。 composer require topthink/think-swoole:4.0.10 --with-all-dependencies

用tp最好是把版本写死。包括小版本号。composer update一次,死一次。 我也是这种情况。回退到4.0.11都每用。回退到4.0.10又一堆库被更新了,导致无法回退。要强行回退所有相关包版本。 composer require topthink/think-swoole:4.0.10 --with-all-dependencies

我本想着新版本应该是可以兼容旧版本而且性能更好,bug更少,更好用。
我试试看你说的这个方法哈,感谢

@w263756314
Copy link
Author

@taozhipeng1990 用你的方法
composer require topthink/think-swoole:4.0.10
确实可以启动成功,感谢!

启动成功也带来了新的问题,用 swoole 的端口访问,静态资源打开变404,服务端出现 :
WARNING Context::build_header() (ERRNO 7105): You have set 'Transfer-Encoding', 'Content-Length' will be ignored
我还要再折腾一下,再次感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants