简体   繁体   English

即使在编辑 php.ini 后,php 中的最大上传大小限制为 2MB

[英]Max upload size limit 2MB in php even after editting php.ini

I have v annoying pb that am struggling to resolve.我有一个烦人的 pb,正在努力解决。 Basically, when i was testing code on localhost it used to give error if i tried uploading image larger than 2M.基本上,当我在本地主机上测试代码时,如果我尝试上传大于 2M 的图像,它通常会出错。 I have edited php.ini file as advised on other threads and that fixed the problem.我已经按照其他线程的建议编辑了 php.ini 文件并解决了问题。 However, when i moved exactly same code to AWS EC2 instance, I am again getting same issue.但是,当我将完全相同的代码移动到 AWS EC2 实例时,我再次遇到同样的问题。

if i check phpinfo(), that does correctly show如果我检查 phpinfo(),它会正确显示

post_max_size = 30M
upload_max_filesize = 30M

as i would like it to be.正如我希望的那样。 I have also restarted apache, httpd and pretty much anything i could think of for any changes to take into effect, but i am still having this issue.我还重新启动了 apache、httpd 以及几乎所有我能想到的让任何更改生效的东西,但我仍然遇到这个问题。

Adding the following bits directly into the code:将以下位直接添加到代码中:

ini_set('upload_max_filesize', '30M');

Anyone could help with this please?有人可以帮忙吗? Thanks谢谢

if you're using unix based system (linux) you may try to create a new file in your root directory(eg: var/www or public_html ) with this name: .user.ini (Exactly this name. Dot at the beginning is required).如果您使用的是基于 unix 的系统 (linux),您可以尝试在根目录中创建一个新文件(例如: var/wwwpublic_html ),名称为: .user.ini (正是这个名称。开头的点是必需的)。 Then try to set your values:然后尝试设置您的值:

post_max_size = 30M
upload_max_filesize = 30M

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Wordpress php.ini文件将upload_max_filesize设置为大约2MB上传 - Wordpress php.ini file to set upload_max_filesize to get around 2MB upload 在PHP中文件上传大小甚至不到2MB - File upload size is not even 2MB in PHP 上传超过 1MB 的任何内容时 php.ini 不允许即使更改 post_max_size、upload_max_filesize 和 memory_limit AWS - When uploading anything over 1MB php.ini does not allow even when changed post_max_size, upload_max_filesize and memory_limit AWS 服务器上传大小限制,但不是php.ini - Server upload size limit but not php.ini 尽管php.ini中设置了10M,但无法上传大于2MB的图像 - Can't upload images larger than 2MB despite the 10M settings in php.ini 为什么我不能上传大于 2MB 的文件? php.ini 已经被编辑过 - Why can I not upload files greater than 2MB? Php.ini has already been edited PHP-编辑php.ini后,即使上传1MB以上的文件也无法上传 - PHP - Unable to upload file even above 1MB and after edited php.ini 在php.ini上更改upload_max_filesize后,PHP文件的上传大小受到限制 - PHP file upload size is limited after changing upload_max_filesize on php.ini php.ini中的最大上传限制文件大小 - Maximum upload limit file size in the php.ini PHPMyAdmin最大上传大小不会更改,错误的php.ini文件 - PHPMyAdmin max upload size will not change, wrong php.ini file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM