在PHPMyAdmin中导入文件大小限制

本文翻译自:Import file size limit in PHPMyAdmin

I have changed all the php.ini parameters I know: upload_max_filesize , post_max_size . 我已经更改了所有我知道的php.ini参数: upload_max_filesizepost_max_size

Why am I still seeing 2MB? 为什么我仍然看到2MB?

Im using Zend Server CE, on a Ubuntu VirtualBox over a Windows 7 host. 我在Windows 7主机上的Ubuntu VirtualBox上使用Zend Server CE。


#1楼

参考:https://stackoom.com/question/gBOD/在PHPMyAdmin中导入文件大小限制


#2楼

Find the file called: php.ini on your server and follow below steps 在您的服务器上找到名为php.ini ,然后执行以下步骤

With apache2 and php5 installed you need to make three changes in the php.ini file. 安装apache2和php5后,您需要在php.ini文件中进行三处更改。 First open the file for editing, eg: 首先打开文件进行编辑,例如:

sudo gedit /etc/php5/apache2/php.ini

OR 要么

sudo gedit /etc/php/7.0/apache2/php.ini

Next, search for the post_max_size entry, and enter a larger number than the size of your database (15M in this case), for example: 接下来,搜索post_max_size条目,然后输入比数据库大小更大的数字(在这种情况下为15M),例如:

post_max_size = 25M

Next edit the entry for memory_limit and give it a larger value than the one given to post_max_size . 接下来,编辑memory_limit的条目,并为其赋予比post_max_size更大的值。

Then ensure the value of upload_max_filesize is smaller than post_max_size . 然后确保upload_max_filesize的值小于post_max_size

The order from biggest to smallest should be: 从大到小的顺序应为:

    memory_limit
    post_max_size
    upload_max_filesize

After saving the file, restart apache (eg sudo /etc/init.d/apache2 restart ) and you are set. 保存文件后,重新启动apache(例如sudo /etc/init.d/apache2 restart ),您便会设置好。

Don't forget to Restart Apache Services for changes to be applied. 不要忘记Restart Apache Services以应用更改。

For further details, click here . 有关更多详细信息, 请单击此处


#3楼

Increase phpMyAdmin upload / import size 增加phpMyAdmin上传/导入大小

By default you get a 2mb limit of upload / import size in phpmyadmin. 默认情况下,您在phpmyadmin中的上传/导入大小限制为2mb。 That makes it odd and highly impossible to import larger files. 这使得导入更大的文件变得很奇怪并且极不可能。 You can increase the allowed upload size of phpmyadmin by editing your server's php.ini configuration file. 您可以通过编辑服务器的php.ini配置文件来增加phpmyadmin允许的上传大小。 Usually in servers like CentOs it is located at /etc/php.ini. 通常在CentO之类的服务器中,它位于/etc/php.ini中。

Step 1: Go to php.ini and find the following and change their values to something more higher than your database size. 第1步:转到php.ini,找到以下内容并将其值更改为大于数据库大小的值。 (In this example i have used 20mb). (在此示例中,我使用了20mb)。

upload_max_filesize = 20M

post_max_size = 20M

Step2 : Restart your apache service for this new change to take effect. 步骤2:重新启动apache服务,以使新更改生效。 Usually the command to restart apache would be 通常,重启apache的命令是

service httpd restart (CentOs) / service apache2 restart (ubuntu)

You can also restart directly from their path like 您也可以直接从其路径重新启动,例如

/etc/init.d/apache2 restart or /etc/init.d/httpd restart

If you are in a shared hosting and do not have root access or access to your php.ini configuration file, then the other way is to create a .htaccess file in your application root and add the following line 如果您位于共享主机中,并且没有root用户访问权限或对php.ini配置文件的访问权限,那么另一种方法是在应用程序根目录中创建.htaccess文件,并添加以下行

php_value upload_max_filesize 10M
php_value post_max_size 10M

If you were still not able to increase it, please send me an email for more detailed assistance. 如果您仍然无法增加它,请给我发送电子邮件以获取更多详细帮助。


#4楼

I found that increasing the upload and post limit in php.ini did not affect the limit in phpmyadmin. 我发现增加php.ini中的上传和发布限制不会影响phpmyadmin中的限制。 This is because my server has a separate setting for cpanel upload limit. 这是因为我的服务器为cpanel上传限制设置了单独的设置。 If you have access to WHM, you probably have this. 如果您可以访问WHM,则可能拥有此权限。

To adjust: 调整:

  • login to your WHM panel: this is usually located at {your server ip}/whm and you will need your root login details here. 登录到WHM面板:该帐户通常位于{您的服务器ip} / whm,您将在此处需要您的root登录详细信息。 If you don't have those, request them from your host. 如果您没有这些,请向您的房东提出要求。
  • once logged in, in the top left search bar, search for "tweak settings" 登录后,在左上方的搜索栏中搜索“调整设置”
  • On the tweak setting pages, search for "cPanel PHP max upload size" 在调整设置页面上,搜索“ cPanel PHP最大上传大小”
  • Adjust the number and save 调整数量并保存

No need to restart apache or anything, changes are instant. 无需重新启动apache或任何东西,更改是即时的。 This process increased the value of max upload file size in phpmyadmin. 此过程增加了phpmyadmin中最大上传文件大小的值。 You can check this by going to phpmyadmin and selecting your database, then clicking "import" at the top. 您可以通过以下方式进行检查:转到phpmyadmin并选择数据库,然后单击顶部的“导入”。 Beside the file selector you will see the upload limit. 在文件选择器旁边,您将看到上传限制。 My server default was 100. 我的服务器默认值为100。


#5楼

C:\\xampp\\php\\php.ini in my case or it could be C:\\php\\php.ini if the Apache / PHP / MySQL are stand alone 在我的情况下为C:\\ xampp \\ php \\ php.ini,或者如果Apache / PHP / MySQL独立存在,则可能为C:\\ php \\ php.ini

upload_max_filesize = 2M by default 默认情况下upload_max_filesize = 2M

so it can be changed as desired. 因此可以根据需要进行更改。 And in my case upload_max_filesize = 20M 在我的情况下, upload_max_filesize = 20M

post_max_size = 8M by default it should be changed to post_max_size = 20M as well 默认情况下, post_max_size = 8M ,也应将其更改为post_max_size = 20M

memory_limit=128M is by default and it is not necessary to change to increase the max 2056kb or 2mb .sql file upload limit. 默认情况下,memory_limit = 128M,无需更改以增加最大2056kb或2mb .sql文件上载限制。 But it only means that a script can consume up to 128 memory when you run apache and sql server , and if you change memory_limit=128M to higher and run any malfunctioned script then it may cause you trouble. 但这仅意味着当您运行apache和sql server时,一个脚本最多可消耗128个内存,并且如果将memory_limit = 128M更改为更高的值并运行任何出现故障的脚本,则可能会造成麻烦。 So its up to you. 因此,取决于您。


#6楼

How to import huge amount of Data in Xampp 如何在Xampp中导入大量数据

It's the best solution to open new, clean database, and import the file in phpMyAdmin. 这是打开新的干净数据库并将文件导入phpMyAdmin的最佳解决方案。 Choose file from local folder and leave all settings as is. 从本地文件夹中选择文件,然后保留所有设置。 That should be it. 应该是这样。

But if your file exceeded file size of 2MB (that is default value in xampp installation) than you need to tweak some out. 但是,如果您的文件超出了2MB的文件大小(这是xampp安装中的默认值),则需要进行一些调整。 Basically we will just increase the maximum upload file size. 基本上,我们只会增加最大上传文件大小。

Open your xampp install folder and go to php folder. 打开您的xampp安装文件夹,然后转到php文件夹。 With some text editor file (notepad++) open the file called php.ini (by type windows describe it as configuration settings) and edit the line (cca. 770, or press ctrl+f in notepad++ to find it): 使用一些文本编辑器文件(notepad ++)打开名为php.ini的文件(通过键入Windows将其描述为配置设置)并编辑该行(大约770,或在notepad ++中按ctrl + f来找到它):

post_max_size = 2M

instead 2M, put wanted maximum file size (16MB for example but not higher than 128M), 而不是2M,放置所需的最大文件大小(例如16MB,但不超过128M),

after that go to this line: max_execution_time = 30 instead 30, increase execution time that's in seconds (90 for example), also you need to change this line: 之后,转到此行:max_execution_time = 30而不是30,增加以秒为单位的执行时间(例如90),还需要更改此行:

max_input_time = 60

instead 60, increase input time in seconds (120 for example) and top of all you have to change this line: 改为60,增加以秒为单位的输入时间(例如120),最重要的是,您需要更改此行:

upload_max_filesize = 2M

instead of 2M, increase to 16M for example. 而不是2M,例如增加到16M。 Save the file, restart apache and mysql in xampp and try to upload again, if you follow correctly you should be able to import files through 16MB (example) 保存文件,在xampp中重新启动apache和mysql,然后尝试再次上传,如果您按照正确的方法操作,则应该能够通过16MB导入文件(示例)

  • 0
    点赞
  • 0
    评论
  • 1
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值