lsky-org/lsky-pro

500服务器错误

chengnans opened this issue · 7 comments

同样的问题

[2023-12-20 08:50:46] prod.ERROR: Carbon\Carbon::setLastErrors(): Argument #1 ($lastErrors) must be of type array, bool given, called in /var/www/lskypro/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php on line 98 {"exception":"[object] (TypeError(code: 0): Carbon\\Carbon::setLastErrors(): Argument #1 ($lastErrors) must be of type array, bool given, called in /var/www/lskypro/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php on line 98 at /var/www/lskypro/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:928)
[stacktrace]
#0 /var/www/lskypro/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(98): Carbon\\Carbon::setLastErrors()
#1 /var/www/lskypro/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(252): Carbon\\Carbon->__construct()
#2 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(259): Carbon\\Carbon::now()
#3 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(221): Illuminate\\Session\\Middleware\\StartSession->getCookieExpirationDate()
#4 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(125): Illuminate\\Session\\Middleware\\StartSession->addCookieToResponse()
#5 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
#6 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle()
#7 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#8 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
#9 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#10 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
#11 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#12 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Routing/Router.php(724): Illuminate\\Pipeline\\Pipeline->then()
#13 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Routing/Router.php(703): Illuminate\\Routing\\Router->runRouteWithinStack()
#14 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Routing/Router.php(667): Illuminate\\Routing\\Router->runRoute()
#15 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Routing/Router.php(656): Illuminate\\Routing\\Router->dispatchToRoute()
#16 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\\Routing\\Router->dispatch()
#17 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#18 /var/www/lskypro/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(60): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#19 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle()
#20 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#21 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#22 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#23 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#24 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#25 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#26 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#27 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#28 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#29 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#30 /var/www/lskypro/vendor/fruitcake/laravel-cors/src/HandleCors.php(38): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#31 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Fruitcake\\Cors\\HandleCors->handle()
#32 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#33 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#34 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#35 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\\Pipeline\\Pipeline->then()
#36 /var/www/lskypro/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#37 /var/www/lskypro/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle()
#38 {main}
"}

如果无法将 PHP 版本更改为 8.1,则可以更新此行

文件路径

./vendor/nesbot/carbon/src/Carbon/Traits/Creator.php

行号:

928

旧线

私有静态函数 setLastErrors(array $lastErrors)

新行

私有静态函数 setLastErrors($lastErrors)

https://stackoverflow.com/questions/74749564/laravel-carbon-carbonsetlasterrors

亲测有效

太强了兄弟,完美解决,搜索引擎完全没找到解决方案,问chatgpt也没反应,只说是carbon这个的问题,只有你解决了我的问题,你才是真正的英雄

image我把setLastErrors改了还是不行

image我把setLastErrors改了还是不行

你是不是chmod文件权限没设置?我试过没权限也会500报错

image我把setLastErrors改了还是不行

你是不是chmod文件权限没设置?我试过没权限也会500报错

已解决 多谢大佬 是由于数据库配置问题