[英]PHP Warning: POST Content-Length of 8412174 bytes exceeds the limit of 8388608 bytes in Unknow
I'm working on an heroku app thah will run PHP and slim framework to create an REST API service.我正在开发一个 Heroku 应用程序,它将运行 PHP 和超薄框架来创建 REST API 服务。 I have an endpoint that is responsable to accept uploaded files using
FormData()
on the front-end and that after processing will give the result back to the user so the content can be downloaded.我有一个端点负责在前端使用
FormData()
接受上传的文件,处理后会将结果返回给用户,以便可以下载内容。 I'm having some trouble with slim and heroku.我在使用 slim 和 heroku 时遇到了一些麻烦。 If I try to upload a png image I will get this error from slim:
如果我尝试上传 png 图像,我会从 slim 收到此错误:
PHP Fatal error: Uncaught RuntimeException: is not a valid uploaded file in /app/vendor/slim/psr7/src/UploadedFile.php:165
I don't know why this occur, it seems that the file isn't passed to the script, I'm supposing this because there is no file name into the error message, I'm using a library to manage the upload process, the library will accept the Psr7 UploadedFileInterface
that is provided by slim when a file is uploaded and works fine in my localhost server, the problem is probably only with slim and I don't know how to fix it.我不知道为什么会发生这种情况,似乎文件没有传递给脚本,我假设这是因为错误消息中没有文件名,我正在使用库来管理上传过程,当上传文件并在我的本地主机服务器中正常工作时,库将接受由 slim 提供的
Psr7 UploadedFileInterface
,问题可能仅与 slim 相关,我不知道如何修复它。
Another problem is with my heroku dyno settings.另一个问题是我的 heroku dyno 设置。 I've created a
.user.ini
file inside the root of the deployed project but I get the error about the POST
content length.我在已部署项目的根目录中创建了一个
.user.ini
文件,但是我收到了关于POST
内容长度的错误。 This is the content of the file:这是文件的内容:
post_max_size = 20M
upload_max_filesize = 50M
memory_limit = 256M
Is there a way to fix this two problems?有没有办法解决这两个问题?
I've found the solution to the problem.我已经找到了问题的解决方案。 I forget to commit the modifications I've made when the
.user.ini
file was created.我忘记提交我在创建
.user.ini
文件时所做的修改。 I've just prepared all files for commit and then using the terminal I've pushed the updated files to my heroku app.我刚刚准备好所有要提交的文件,然后使用终端将更新的文件推送到我的 heroku 应用程序。
git commit -am "commit message"
git push heroku master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.