PHP 警告:8978294 字节的 POST 内容长度超过第 0 行未知中 8388608 字节的限制

2022-01-14 00:00:00 xampp php wordpress

在我的 XAMPP 本地开发环境中尝试在 WordPress 上上传导入时出现此错误:

I am getting this error when trying to upload an import on WordPress on my XAMPP local dev environment:

警告:8978294 字节的 POST 内容长度超出第 0 行 Unknown 中 8388608 字节的限制

Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

我将 upload_max_filesize2M 更改为 1000M,但这似乎没有任何作用.

I changed the upload_max_filesize from 2M to 1000M, but that didn't seem to do anything.

有什么想法吗?

推荐答案

8388608 字节为 8M,PHP 中的默认限制.将 php.ini 中的 post_max_size 更新为更大的值.

8388608 bytes is 8M, the default limit in PHP. Update your post_max_size in php.ini to a larger value.

upload_max_filesize 设置用户可以上传的最大文件大小,同时post_max_size 设置表单中可以通过 POST 发送的最大数据量.

upload_max_filesize sets the max file size that a user can upload while post_max_size sets the maximum amount of data that can be sent via a POST in a form.

所以你可以将 upload_max_filesize 设置为 1 兆,这意味着用户可以上传的最大单个文件是 1 兆字节,但如果 post_max_size 可以一次上传 5 个 设置为 5.

So you can set upload_max_filesize to 1 meg, which will mean that the biggest single file a user can upload is 1 megabyte, but they could upload 5 of them at once if the post_max_size was set to 5.

更改将在服务器重启后生效.

Changes will take effect after a restart of the server.

相关文章