上传的文件超过了 php.ini 中的upload_max_filesize 指令,在上传插件时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36963262/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 00:59:49  来源:igfitidea点击:

The uploaded file exceeds the upload_max_filesize directive in php.ini error while uploading plugin

phpwordpress

提问by beginner

When I tried to upload a plugin for my Wordpress template in wamp 2.0I got an error:

当我尝试在wamp 2.0 中为我的 Wordpress 模板上传插件时,出现错误:

The uploaded file exceeds the upload_max_filesize directive in php.ini

上传的文件超过了 php.ini 中的 upload_max_filesize 指令

How to fix this error?

如何修复此错误?

采纳答案by Udhav Sarvaiya

We have seen this error at least once if we have used WordPress.When installing a theme, plugin or uploading an image or file, It has nothing to do with the theme or plugin. The issue is with our server settings which limit the maximum size for uploaded files.

如果我们使用过WordPress,我们至少见过一次这个错误。安装主题、插件或上传图像或文件时,与主题或插件无关。问题在于我们的服务器设置限制了上传文件的最大大小。

It's a common error and it can be easily fixed. This error message is an indication of that the file you are trying to upload is larger than your web host allows (WordPress default file upload size is 2 MB).

这是一个常见的错误,很容易修复。此错误消息表明您尝试上传的文件大于您的网络主机允许的大小(WordPress 默认文件上传大小为 2 MB)。

The uploaded file exceeds the upload_max_filesize directive in php.ini

上传的文件超过了 php.ini 中的 upload_max_filesize 指令

Solution:

解决方案:

A solution is easy, need to increase the file size upload limit.

一个解决方案很简单,需要增加文件大小上传限制。

If using WordPress on a local machine using XAMPP, we will find the php.ini in the following locations. Windows: C:/xampp/php/php.ini

如果在使用 XAMPP 的本地机器上使用 WordPress,我们将在以下位置找到 php.ini。 视窗:C:/xampp/php/php.ini

Open the php.ini file. Find these lines in the php.ini file and replace it following numbers

打开 php.ini 文件。在 php.ini 文件中找到这些行并将其替换为以下数字

upload_max_filesize = 64M

Save the changes and refresh your website and try uploading the file again. You will now get success.

保存更改并刷新您的网站,然后再次尝试上传文件。您现在将获得成功。

回答by Denno

Seeing as though you've mentioned WAMP, I'm going to assume you can edit the php.ini file?

好像您提到了 WAMP,我假设您可以编辑 php.ini 文件?

If you left click on the WAMP icon in the status bar, select the PHP menu and then click on the php.ini file in that menu. Just open it in Notepad is fine.

如果您左键单击状态栏中的 WAMP 图标,请选择 PHP 菜单,然后单击该菜单中的 php.ini 文件。用记事本打开就好了。

Then in Notepad, do a search (CTRL+F) for "upload_max_filesize", and then you can change the value that is set there.

然后在记事本中,搜索 (CTRL+F) 以查找“upload_max_filesize”,然后您可以更改在那里设置的值。

I don't remember what the default is, but for mine, I have it set to "200M" (without the quotes). This means 200mb.

我不记得默认值是什么,但对于我来说,我将它设置为“200M”(不带引号)。这意味着 200mb。

Save the file, close it, and then restart WAMP.

保存文件,关闭它,然后重新启动 WAMP。

You should then be right to upload your plugin

然后你应该正确上传你的插件

回答by Hasnain Mehmood

In Wamp > PHP > php.ini file, put or edit these lines, and then restart your Wamp server.

在 Wamp > PHP > php.ini 文件中,放置或编辑这些行,然后重新启动 Wamp 服务器。

post_max_size = 750M 
upload_max_filesize = 750M 
max_execution_time = 5000
max_input_time = 5000  
memory_limit = 1000M

回答by Malik Shahzaib

This error is because your upload_max_filesize variable in php.ini file is adjusted to 2Mb.. change it to 64Mb!! This video tutorialwill help you fixing your error in 60 seconds!! Hope it helps

这个错误是因为你在php.ini文件中的upload_max_filesize变量被调整为2Mb..改成64Mb!! 本视频教程将帮助您在 60 秒内修复错误!!希望能帮助到你

回答by Sumit Kumar Gupta

Open your xampp software and click on config button in front of apache option and select php.ini option

打开您的 xampp 软件并单击 apache 选项前面的配置按钮并选择 php.ini 选项

Next find this code

接下来找到这个代码

upload_max_filesize=2M

and replace with this code

并用此代码替换

upload_max_filesize=64M

Now restart apache and mysql and enjoy it

现在重新启动 apache 和 mysql 并享受它

回答by Mansi

A Solution is easy, you just want to add plugin in your WordPress.

解决方案很简单,您只需在WordPress.

  1. Download your .zipfile of plugin.
  2. Extractthe .zipfile.
  3. Now, upload the extracted folder to ../wp-content/plugins/location.
  4. Go to the Installed Pluginspage in WordPress, Now you can see the plugin is there, which you have recently uploaded.
  5. Finally, click activatelink.
  1. 下载您.zip的插件文件。
  2. Extract.zip文件。
  3. 现在,将提取的文件夹上传到../wp-content/plugins/位置。
  4. 转到 中的Installed Plugins页面WordPress,现在您可以看到插件在那里,这是您最近上传的。
  5. 最后,点击activate链接。

回答by Hossain Mahmood Tuhin

I use MAMP. To locate the 'php.ini' file, if you also use MAMP, the way Is as follows:

我使用 MAMP。定位'php.ini'文件,如果你也用MAMP的话,方法如下:

  1. Go to the folder location where the MAMP is installed. For example, 'C:\MAMP' Is the folder location of MAMP.
  2. Go to 'conf' folder.
  3. From 'localhost:8888/MAMP', you will get 'phpinfo' link under PHP section. Click on the link and from the directed page, get the version of PHP is installed into your system.
  4. From 'conf' folder, go to the folder with the version of PHP you got in the previous step.
  5. Go to that folder and you will get the required php.ini file.
  6. Open that file in any text editor and update the info: (memory_limit = 64M, upload_max_filesize = 128M, post_max_size = 512M)
  7. Restart MAMP. Then you are good to go for uploading big files into your local server.
  1. 转到安装 MAMP 的文件夹位置。例如,'C:\MAMP' 是 MAMP 的文件夹位置。
  2. 转到“conf”文件夹。
  3. 从“localhost:8888/MAMP”,您将在 PHP 部分下获得“phpinfo”链接。单击链接并从定向页面中,获取安装到系统中的 PHP 版本。
  4. 从“conf”文件夹中,转到包含您在上一步中获得的 PHP 版本的文件夹。
  5. 转到该文件夹​​,您将获得所需的 php.ini 文件。
  6. 在任何文本编辑器中打开该文件并更新信息:(memory_limit = 64M,upload_max_filesize = 128M,post_max_size = 512M)
  7. 重新启动 MAMP。然后你就可以将大文件上传到本地服务器了。

回答by Umashankar Chaudhary

Find this line in the php.inifile upload_max_filesize = 2Mand replace it with a higher value (e.g. upload_max_filesize = 64M)

php.ini文件中找到这一行upload_max_filesize = 2M并将其替换为更高的值(例如upload_max_filesize = 64M

And restart wamp..!

并重新启动 wamp ..!

回答by Krishneil

Locate the php.ini file in your local dir. I use Xampp. =>C:\Xampp. Now find the line where it says

在本地目录中找到 php.ini 文件。我使用 Xampp。=> C:\Xampp. 现在找到它说的那一行

upload_max_filesize = 2M

and change this to your desired value.

并将其更改为您想要的值。

upload_max_filesize = 56M

Restart all your services and you should be able to upload your new files.

重新启动所有服务,您应该能够上传新文件。

回答by Farhan Khan

Windows: C:/xampp/htdocs/wordpress_project/.htaccess php_value upload_max_filesize 1000M php_value post_max_size 2000M php_value memory_limit 3000M php_value max_execution_time 180 php_value max_input_time 180 // in end tag of wordpress

Windows:C:/xampp/htdocs/wordpress_project/.htaccess php_value upload_max_filesize 1000M php_value post_max_size 2000M php_value memory_limit 3000M php_value max_execution_time 180 php_value max_input_time 180 的结束标记 // 在 wordpress 中