php 无法增加文件上传大小 WAMP
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38604640/
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
Can not increase file upload size WAMP
提问by djsaiim
I am using Wampserver (32 bits & PHP 5.5) 2.5. phpmyadmin inside of it is allowing me to import database of max 128mib and execution time is low.
我正在使用 Wampserver(32 位和 PHP 5.5)2.5。它里面的 phpmyadmin 允许我导入最大 128mib 的数据库并且执行时间很短。
In WAMPServer 2.5 the PHP limits applied to phpMyAdmin can be found in this file \wamp\alias\phpmyadmin.conf
在 WAMPServer 2.5 中,适用于 phpMyAdmin 的 PHP 限制可以在此文件 \wamp\alias\phpmyadmin.conf 中找到
The question is that i am unaware about the values insert. I want to upload a file of 5GB. I have changed the values in relevant file and values are also changed in that file as well as phpmyadmin but when i import my 5GB file it gave me following error on phpmyadmin.
问题是我不知道插入的值。我想上传一个 5GB 的文件。我已经更改了相关文件中的值,并且该文件和 phpmyadmin 中的值也发生了更改,但是当我导入 5GB 文件时,它在 phpmyadmin 上出现了以下错误。
"You probably tried to upload a file that is too large. Please refer to documentation for a workaround for this limit."
“您可能尝试上传过大的文件。请参阅文档以了解此限制的解决方法。”
Can someone please help me about the parameters value that i should insert in below parameters for 5GB fileto import in wamp???
有人可以帮助我了解我应该在以下参数中插入的参数值,以便在 wamp 中导入5GB 文件吗???
php_admin_value upload_max_filesize **??**
php_admin_value post_max_size **??**
php_admin_value max_execution_time **??**
php_admin_value max_input_time **??**
回答by RiggsFolly
With a database backup file that big it would be easier to use the MYSQL Console
to restore this database. It does not have any of the size and runtime limitations that a php script does.
使用这么大的数据库备份文件,使用MYSQL Console
恢复该数据库会更容易。它没有 php 脚本的任何大小和运行时限制。
Using the wampmanager icon in the system tray you do this
使用系统托盘中的 wampmanager 图标执行此操作
wampmanager -> MYSQL -> MYSQL Console
click the MYSQL Console
menu and it will run mysql.exe
in a command windows.
单击MYSQL Console
菜单,它将mysql.exe
在命令窗口中运行。
It will challenge you for the root
password first, so if you have not changed that MYSQL accounts password just hit enter
它会首先挑战你的root
密码,所以如果你没有更改那个 MYSQL 帐户密码,只需点击enter
If you have changed the root
password enter the password and hit Enter
如果您更改了root
密码,请输入密码并点击Enter
Now at the mysql>
command prompt enter
现在在mysql>
命令提示符下输入
source C:/path/to/your/backup.sql
And mysql will run the restore for as long as it takes to complete the restore
并且只要完成恢复,mysql 就会运行恢复
If you must use phpMyAdmin then you will need to amend the correct configurations to do that.
如果您必须使用 phpMyAdmin,那么您需要修改正确的配置才能做到这一点。
The phpMyAdmin alias contains these parameters for this very purpose and of course will override the standard php.ini
setting of these parameters. Afterall you dont want to amend the php.ini
for a restore you will only run maybe once, and affect the whole PHP environment permanantly.
phpMyAdmin 别名为此目的包含这些参数,当然会覆盖php.ini
这些参数的标准设置。毕竟你不想修改php.ini
你可能只运行一次的恢复,并永久地影响整个 PHP 环境。
The phpMyAdmin config can be found in \wamp\alias\phpmyadmin.conf
phpMyAdmin 配置可以在 \wamp\alias\phpmyadmin.conf
Alias /phpmyadmin "D:/wamp/apps/phpmyadmin4.7.0/"
<Directory "D:/wamp/apps/phpmyadmin4.7.0/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
<ifDefine APACHE24>
Require local
</ifDefine>
<ifDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from localhost ::1 127.0.0.1
</ifDefine>
# To import big file you can increase values
php_admin_value upload_max_filesize 128M
php_admin_value post_max_size 128M
php_admin_value max_execution_time 360
php_admin_value max_input_time 360
</Directory>
All you need to do is increase the relevant values, so for example you could try these
您需要做的就是增加相关值,例如您可以尝试这些
php_admin_value upload_max_filesize 5128M
php_admin_value post_max_size 5256M
php_admin_value max_execution_time 600
php_admin_value max_input_time 600
回答by Shown Marsh
Go to your Wamp installed directory and follow the below steps and open the “phpmyadmin.conf” file
转到您的 Wamp 安装目录并按照以下步骤打开“phpmyadmin.conf”文件
<wamp_dir>/alias/phpmyadmin.conf
You will see the below code in the end of the file :
您将在文件末尾看到以下代码:
# To import big file you can increase values
php_admin_value upload_max_filesize 128M
php_admin_value post_max_size 128M
php_admin_value max_execution_time 360
php_admin_value max_input_time 360
Replace it with the given code :
用给定的代码替换它:
# To import big file you can increase values
php_admin_value upload_max_filesize 1024M
php_admin_value post_max_size 1024M
php_admin_value max_execution_time 1800
php_admin_value max_input_time 1800
Now you can upload large size of the files in the Wamp phpmyadmin.
现在您可以在 Wamp phpmyadmin 中上传大尺寸的文件。
I have taken inspiration from this post : http://www.codecanal.com/increase-the-database-upload-size-in-wamp-server/
我从这篇文章中获得灵感:http: //www.codecanal.com/increase-the-database-upload-size-in-wamp-server/
回答by Faizan Younus
You need to increase following values in php.inifile and restart the WAMP Server
您需要在php.ini文件中增加以下值并重新启动 WAMP Server
memory_limit
post_max_size
upload_max_filesize
Make sure the value of upload_max_filesize is smaller than post_max_size.
确保upload_max_filesize 的值小于post_max_size。
Hop this helps.
跳这有帮助。
回答by Bhavik Hirani
you have to increase upload size from php
你必须从 php 增加上传大小
ini_set('post_max_size', '128M');
ini_set('upload_max_filesize', '128M');
and also you can set with php.ini
你也可以用php.ini设置
post_max_size = 128M
upload_max_filesize = 128M