简体   繁体   English

PHP 警告:8412174 字节的 POST Content-Length 超出了 Unknow 中 8388608 字节的限制

[英]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.

相关问题 PHP 警告:8978294 字节的 POST 内容长度超出第 0 行未知中 8388608 字节的限制 - PHP Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0 警告:11394639字节的POST内容长度超过了8388608字节的限制 - Warning: POST Content-Length of 11394639 bytes exceeds the limit of 8388608 bytes 警告:POST Content-Length的25447804字节超出了第0行上Unknown中的8388608字节的限制 - Warning: POST Content-Length of 25447804 bytes exceeds the limit of 8388608 bytes in Unknown on line 0 警告:90612004 字节的 POST Content-Length 超出了第 0 行未知中 8388608 字节的限制 - Warning: POST Content-Length of 90612004 bytes exceeds the limit of 8388608 bytes in Unknown on line 0 如何避免:警告:POST内容长度47820076字节超过了第0行的Unknown中的8388608字节限制 - How to avoid: Warning: POST Content-Length of 47820076 bytes exceeds the limit of 8388608 bytes in Unknown on line 0 PHP 警告:未知:68 字节的 POST 内容长度超过第 0 行未知中 10 字节的限制, - PHP Warning: Unknown: POST Content-Length of 68 bytes exceeds the limit of 10 bytes in Unknown on line 0, 处理得很好“POST内容 - 字节长度超过”警告限制 - Handle nicely “POST Content-Length of bytes exceeds the limit of” warning 文件上载警告发布内容的字节长度超出限制 - File Upload Warning post content-length of bytes exceeds the limit PHP警告:53160843字节的POST内容长度超过了行0上“未知”中的33554432字节的限制 - PHP Warning: POST Content-Length of 53160843 bytes exceeds the limit of 33554432 bytes in Unknown on line 0 PHP警告:POST内容 - n个字节的长度超过了第0行的Unknown中的3145728个字节的限制 - PHP Warning: POST Content-Length of n bytes exceeds the limit of 3145728 bytes in Unknown on line 0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM