How to Increase phpMyAdmin Import File Size Limit

phpmyadmin import size limitincrease php upload limitphp.ini configurationdatabase migrationphpmyadmin import error
Published·Modified·

As websites grow over time, their databases naturally expand. During migration, you may encounter a situation where the database file exceeds phpMyAdmin's default import limit, preventing direct import. However, you can modify the phpMyAdmin import file size limit to resolve this.

lnmp

When attempting to import a database larger than 2MB using phpMyAdmin, you may see the following error message:

"No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16."

1. Modify the php.ini File

  1. Find post_max_size: This setting defines the maximum amount of data PHP can receive via a POST request, including all form values. The default is 8MB, but you should adjust it based on your needs.
  2. Find File Uploads: Ensure file_uploads = on is set to allow file uploads via HTTP. The default is ON (enabled). Also check upload_tmp_dir.
  3. Find upload_max_filesize: This sets the maximum allowed size for uploaded files. The default is 2MB.
  4. For files larger than 8MB: Simply setting the above parameters may not be sufficient. It is recommended to configure the following additional parameters:
    • max_execution_time: Set to 600. This defines the maximum time (in seconds) a PHP page can run. The default is 30 seconds.
    • max_input_time: Set to 600. This defines the maximum time (in seconds) a PHP page needs to receive data. The default is 60 seconds.
    • memory_limit: Set to 8M (or higher). This defines the maximum memory (in bytes) a PHP page can consume. The default is 8M.

2. Modify phpMyAdmin's import.php File

  1. Find $memory_limit: The default value is $memory_limit = 2 * 1024 * 1024;. Modify this value as needed.
  2. Check subsequent lines: There are similar statements in the next few lines that may also need adjustment.

In my case, modifying the settings in Step 1 was sufficient to bypass the default upload size limit, and Step 2 was not required. You can configure these settings based on your specific situation. Please note that virtual hosting users cannot modify these files. If your database file is too large, you may need to export tables individually.