Import file size limit in PHPMyAdmin

Viewed 1078514

I have changed all the php.ini parameters I know: upload_max_filesize, post_max_size.

Why am I still seeing 2MB?

Im using Zend Server CE, on a Ubuntu VirtualBox over a Windows 7 host.

29 Answers

With WAMP, on Windows10, open

c:\wamp64\alias\phpmyadmin.conf

and change 128 by 256 at the end of these lines

  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M

Restart WAMP

Ubuntu 20.04 Edit: sudo nano /etc/php/7.4/apache2/php.ini

Modify: post_max_size = 120M and upload_max_filesize = 120M

Replace 120 with the value you need, e.g. 22M, etc.

Search for php.ini file

For xampp, you can get it @ C:\xampp\php

Find the following 3 properties and set there value according to your need

memory_limit post_max_size upload_max_filesize

Restart Apache!

I am using Bitnami WAMP Stack 7.1.8-0 on my localhost. For me, the PHPMyAdmin maximum upload size limit was set to 80MiB as in the screenshot https://nimb.ws/fFxv7O. I managed to increase this size limit as explained below:

  1. Go to the folder where you have installed the Bitname WAMP Stack, for me, it is "E:\Bitnami WAMP Stack”
  2. Further inside, go to the path “apps\phpmyadmin\conf"
  3. Open the file httpd-app.conf in your favorite text editor
  4. Find the following two lines:
php_value upload_max_filesize 80M    
php_value post_max_size 80M

(The 80M value at the end of these lines may be different for you)

  1. Go ahead and change these values at the end of these two lines (80M in this case) according to your needs.

  2. Restart WAMP server.

Now go to PHPMyAdmin and see, your upload size limit should be updated to whatever you set it to. That is it.

Note: (added July 2020)

I'm surprised nobody else has mentioned this ... changing php.ini should probably be your last resort when increasing file upload sizes to something as big as 64MB.

It may not matter greatly on development machines, but editing php.ini to globally increase max upload size could be a really bad idea on a server where you have several websites operating. MySQL imports to PHPMyAdmin are often large, but you don't want every Tom, Dick and Mary uploading 64MB files to another site on your server because you need to do it every now and again for your MySQL database.

I'd suggest a better solution is therefore (assuming you are using the standard Apache PHP module) to edit the specific virtual host configuration for PHPMyAdmin.

On Ubuntu Linux, this is found in /etc/apache2/conf-enabled/ phpmyadmin.conf. On WAMP/Windows/Whatever you'll need to look at the setup for your Apache configuration, but it will probably be in conf-enabled, conf.d, sites-enabled, or something like that. These are actually often just symlinks to the actual file which is located somewhere like /etc/phpmyadmin/apache.conf (again using Ubuntu as the example here).

Your apache.conf file will include lines something like this:

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
    Options SymLinksIfOwnerMatch
    DirectoryIndex index.php

    # limit libapache2-mod-php to files and directories necessary by pma
    <IfModule mod_php7.c> 
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/:/usr/share/php/PhpMyAdmin/:/usr/share/php/Symfony/:/usr/share/php/Twig/:/usr/share/php/Twig-Extensions/:/usr/share/php/ReCaptcha/:/usr/share/php/Psr/Container/:/usr/share/php/Psr/Cache/:/usr/share/php/Psr/Log/:/usr/share/php/Psr/SimpleCache/
    </IfModule>

</Directory>

Immediately after <IfModule mod_php7.c> add these lines:

    php_value post_max_size 64M
    php_value upload_max_filesize 64M

Depending on your server config, you can probably achieve the same thing in an .htaccess file if you prefer. In which case you could just add the two lines by themselves (assuming you know for certain that PHP is enabled).

If you use fpm or fastcgi or something with or without Apache, the same more localized approach to controlling upload sizes can be achieved by using .user.ini files.

I've tried all of the above and nothing worked for me: my phpmyadmin (on wamp) was still showing 128MiB (while I've needed to import DB which size was 212Mb)

so if U stucked as me you can import it with the help of commandline:

  1. run bash (cmd, powershell or whatever terminal) from folder where your .sql file is located (or cd that path in terminal)
  2. run mysql -u username -p database_name < file.sql where
    username - is username for mysql server
    database_name - is name of db you want import to file.sql - is name of your sql file

for me just worked like a charm after 2hours of trying to manipulate this through php.ini and other configurational files

Related