Cloud Confusing

Explaining hosting, AWS, Wordpress, static sites, and all manner of cloud solutions.

Are you trying to upload a database to your site, but it’s getting rejected by phpmyadmin? That’s a common issue, but unfortunately it can happen under a number of circumstances and there are many places where the file size restriction can live, making the issue difficult (or at least tedious) to troubleshoot.

Recently this happened to me when trying to install a 200MB database onto a local installation of WordPress, using MAMP for the heavy lifting. My localhost setup would have no issues with a database of this size but phpmyadmin rejected it every time. I wanted to get my local environment set to match the production version, so this was a necessary step.

If you are seeing this error, you have the same issue:

You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.

So the hard part here is finding out where the limit exists. Is it your PHP configuration? It is phpmyadmin itself? It’s not immediately clear, and phpmyadmin is of no help — there is no setting concerning maximum file size for imports and the documentation that the error links to is not helpful.

How to Fix the Import Size Restriction

The first thing try, especially if you are using MAMP + Windows on your local is:

  1. Find your MAMP directory, go to the BIN directory, and locate config.inc.php in phpMyAdmin’s top level directory.
  2. Open with a text editor and search for: $cfg['UploadDir'] = '';
  3. Edit that value between the '' so that you have $cfg['UploadDir'] = 'uploadFolder';
  4. In that same directory create a folder called uploadFolder and move your sql database file into that older
  5. Restart Apache and MySQL. Don’t forget this step.

This is essentially the fix that the phpmyadmin FAQ docs recommend if you are seeing that error or timeouts.

Now try to select the file from the newly-created dropdown in the phpmyadmin Import tool. The old method, of choosing any file you want will be there, but this new uploadFolder directory shortcut should work.

Did that get around the file size limit? Great! If not then the restriction lives elsewhere. This isn’t quite as easy to fix, but it’s not hard. We’ll fix things through the PHP file size limit. This requires messing with your PHP config files, so type carefully.

  1. Navigate to your PHP configuration file: .../phpmyadmin[version#]/config.inc.php. More specifically you are probably looking for Applications/MAMP/bin/php/php5.4.10/conf/php.ini
  2. Increase the upload_max_filesize and post_max_size to appropriate sizes so you can complete your upload. You might need to increase the memory_limit as well, depending on just how big the file it.
  3. Optional: If you are seeing timeouts, you can increase max_execution_time and max_input_time
  4. Restart all service and try the upload.
  5. If it worked then I’d recommend reverting these to more conservative file limits, just so you don’t make any mistakes in the future and slow/crash your system.

Between these two methods you should be all set. If not, there are still other settings you might want to look at, but they will get increasingly specific based on your situation. For instance, if you are not on a local setup with MAMP, but rather a server with CPanel then that app has its own “Tweak” setting called “cPanel PHP Max POST size.” You can increase that in order to import a larger database.

February 5th, 2018

Posted In: Localhost / Environment

Tags: , ,


© Cloudconfusing.com 2022 | Privacy Policy | About | UTM Creator | CVE Reporting