By default, PHPMyAdmin allows you to upload or import a file of Max size 2Mb. But often you may want to import a bigger file into your PHPMyAdmin installation. In this article, we will learn how to increase import file size limit in PHPMyAdmin. PHPMyAdmin depends on two applications to work properly – Apache and PHP. You need to increase file upload limit in both these applications to increase import file size limit in PHPMyAdmin.
How to Increase Import File Size Limit in PHPMyAdmin
Typically, PHP and Apache are installed together and PHPMyAdmin works using both these applications. So we will assume you have already installed Apache & PHP on your system. Basically, you need to make 3 changes to php.ini file.
Open php.ini file in a text editor. Replace php5 and apache2 with the appropriate versions
$ sudo vi /etc/php5/apache2/php.ini
Depending on your PHP version the file location may also be of the following format.
$ sudo vi /etc/php/7.0/apache2/php.ini
Look for post_max_size entry and increase it to a bigger size as per your requirement. We have set it to 50Mb below.
post_max_size = 50M upload_max_filesize = 40M
Also, please ensure the value of upload_max_filesize is smaller than the value of post_max_size.
Save and close the file. Restart Apache server with the following command.
$ sudo /etc/init.d/apache2 restart
The above changes only update PHP settings. Please note, your Apache Server must also support uploading a bigger file. If that is not the case, then you may need to open .htaccess file in a text editor.
$ vi /var/www/html/.htaccess
Let’s say your uploads are stored at /var/www/example.com/wp-uploads, then add the following LimitRequestBody directive for that folder using the following code snippet. It will increase file upload limit to 50Mb
<Directory "/var/www/example.com/wp-uploads"> LimitRequestBody 50000000 </Directory>
Save and close the file. Restart Apache server using the command mentioned earlier to apply changes.
In this article, we have learnt how to increase file upload/import size in PHPMyAdmin. There are two aspects to this change. You need to make changes in php.ini to increase file import limit in PHP. And you also need to increase file import limit by updating .htaccess file, so that even Apache supports it.
How to Add Column After Another Column in MySQL
How to Retrieve MySQL Username and Password
How to Find And Replace Text in Entire Table in MySQL
How to Take Backup of Single Table in MySQL
How to Show Indexes on Table & Database in MySQL