How to fix PHPMyAdmin Error when importing databases: Incorrect format parameter

Learn how to fix the PHPMyAdmin error that appears when you try to import a database (Incorrect format parameter).

In the last days, a friend of mine asked for help in a very old project that uses PHP 5.4, so I had to install a compatible version of xampp for that version of PHP. I configured the php.ini file really fast because I wanted to work on other stuff, however I committed a newbie mistake as I adjusted just a single parameter in the php.ini file that should allow me to import bigger SQL files directly in the browser.

In this article, I will explain you why this exception occurs and how to solve it in your local environment of XAMPP.

How to trigger this exception

If you decide to modify the post_max_size and upload_max_filesize properties of the configuration file of PHP, you need to be careful, because, if you decide to assign a greater value to upload_max_filesize than the allowed size for post_max_size , the exception will be triggered. For example, if you set 2MB to the allowed post max size and 8MB to the max upload filesize like this in your php.ini file:

 

If you try to upload a database to import through PHPMyAdmin, the exception will be thrown.

How to prevent or solve this exception

Be sure to set equal values to the mentioned properties post_max_size and upload_max_filesize. It's just logic, as if you configure a value of these properties greater than the other one, it simply won't work, for example, you cannot upload a file of 5MB if your max allowed filesize is of 8MB (theoretically the filesize passes), but the max allowed POST size is of only 2M, it just doesn't make sense. Fix the values to use the same number and that should be enough (the value can be whatever you need to, not specifically 64MB):

 

Happy coding ❤️!


WhiteAngel Deed

4 Blog posts

Comments