提问前请务必仔细阅读 如何排查故障 和 常见问题。
问题描述:
在此填写
报错内容:
调试模式报错内容:
500 Internal Server Error
POST https://guangruan.life/api/fof/upload
FoF\Upload\Exceptions\InvalidUploadException: Upload max filesize limit reached from php.ini. in /www/flarum/vendor/fof/upload/src/Repositories/FileRepository.php:152
Stack trace:
#0 /www/flarum/vendor/fof/upload/src/Repositories/FileRepository.php(112): FoF\Upload\Repositories\FileRepository->handleUploadError()
#1 /www/flarum/vendor/fof/upload/src/Commands/UploadHandler.php(100): FoF\Upload\Repositories\FileRepository->moveUploadedFileToTemp()
#2 [internal function]: FoF\Upload\Commands\UploadHandler->FoF\Upload\Commands{closure}()
#3 /www/flarum/vendor/illuminate/collections/Collection.php(695): array_map()
#4 /www/flarum/vendor/fof/upload/src/Commands/UploadHandler.php(192): Illuminate\Support\Collection->map()
#5 /www/flarum/vendor/illuminate/bus/Dispatcher.php(122): FoF\Upload\Commands\UploadHandler->handle()
#6 /www/flarum/vendor/illuminate/pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus{closure}()
#7 /www/flarum/vendor/illuminate/pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}()
#8 /www/flarum/vendor/illuminate/bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()
#9 /www/flarum/vendor/illuminate/bus/Dispatcher.php(78): Illuminate\Bus\Dispatcher->dispatchNow()
#10 /www/flarum/vendor/fof/upload/src/Api/Controllers/UploadController.php(52): Illuminate\Bus\Dispatcher->dispatch()
#11 /www/flarum/vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php(116): FoF\Upload\Api\Controllers\UploadController->data()
#12 /www/flarum/vendor/flarum/core/src/Http/RouteHandlerFactory.php(41): Flarum\Api\Controller\AbstractSerializeController->handle()
#13 /www/flarum/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->Flarum\Http{closure}()
#14 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ExecuteRoute->process()
#15 /www/flarum/vendor/flarum/core/src/Api/Middleware/ThrottleApi.php(33): Laminas\Stratigility\Next->handle()
#16 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Api\Middleware\ThrottleApi->process()
#17 /www/flarum/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(44): Laminas\Stratigility\Next->handle()
#18 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\CheckCsrfToken->process()
#19 /www/flarum/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(69): Laminas\Stratigility\Next->handle()
#20 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ResolveRoute->process()
#21 /www/flarum/vendor/flarum/core/src/Http/Middleware/SetLocale.php(51): Laminas\Stratigility\Next->handle()
#22 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\SetLocale->process()
#23 /www/flarum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithHeader.php(58): Laminas\Stratigility\Next->handle()
#24 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\AuthenticateWithHeader->process()
#25 /www/flarum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(31): Laminas\Stratigility\Next->handle()
#26 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\AuthenticateWithSession->process()
#27 /www/flarum/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(52): Laminas\Stratigility\Next->handle()
#28 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\RememberFromCookie->process()
#29 /www/flarum/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle()
#30 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\StartSession->process()
#31 /www/flarum/vendor/flarum/core/src/Api/Middleware/FakeHttpMethods.php(29): Laminas\Stratigility\Next->handle()
#32 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Api\Middleware\FakeHttpMethods->process()
#33 /www/flarum/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle()
#34 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ParseJsonBody->process()
#35 /www/flarum/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle()
#36 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\HandleErrors->process()
#37 /www/flarum/vendor/flarum/core/src/Http/Middleware/InjectActorReference.php(25): Laminas\Stratigility\Next->handle()
#38 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\InjectActorReference->process()
#39 /www/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(75): Laminas\Stratigility\Next->handle()
#40 /www/flarum/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process()
#41 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\RequestHandler->process()
#42 /www/flarum/vendor/middlewares/base-path-router/src/BasePathRouter.php(101): Laminas\Stratigility\Next->handle()
#43 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\BasePathRouter->process()
#44 /www/flarum/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(36): Laminas\Stratigility\Next->handle()
#45 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Laminas\Stratigility\Middleware\OriginalMessages->process()
#46 /www/flarum/vendor/middlewares/base-path/src/BasePath.php(73): Laminas\Stratigility\Next->handle()
#47 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\BasePath->process()
#48 /www/flarum/vendor/flarum/core/src/Http/Middleware/ProcessIp.php(24): Laminas\Stratigility\Next->handle()
#49 /www/flarum/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ProcessIp->process()
#50 /www/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(75): Laminas\Stratigility\Next->handle()
#51 /www/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(64): Laminas\Stratigility\MiddlewarePipe->process()
#52 /www/flarum/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(73): Laminas\Stratigility\MiddlewarePipe->handle()
#53 /www/flarum/vendor/flarum/core/src/Http/Server.php(45): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
#54 /www/flarum/public/index.php(26): Flarum\Http\Server->listen()
#55 {main}
已尝试的解决办法:
在php.ini修改下面几个配置,仍然报错
max_execution_time = 30
date.timezone = Asia/Kolkata
upload_max_file_size = 150M
max_file_uploads = 20
file_uploads = On
allow_url_fopen = On
我使用的是nginx,我也在flarum’根目录下得.nginx.conf配置添加了上传大小限制,在location下添加一个client_max_body_size 12M;
,奇怪的是,如果上传小文件就可以,大文件就不行,不知道是哪里没有配置好,我也在flarum后台管理的FoF Upload配置了最大文件大小是10240KB,最大10M,应该也可以了吧,求助大佬。下面是我的.nginx.conf
配置文件
location / {
try_files $uri $uri/ /index.php?$query_string;
}
client_max_body_size 12M;