Increase phpMyAdmin Import File Size Limit
This guide shows you how to raise the maximum file size phpMyAdmin accepts for imports, so you can upload larger SQL dumps or backup files without errors. You’ll need access to your server’s PHP configuration files (php.ini, .htaccess, or cPanel’s MultiPHP INI Editor) and the ability to restart your web server if you edit php.ini directly.
What You’ll Need
- Access to your server’s file system (FTP, cPanel File Manager, or SSH)
- Permission to edit PHP configuration files (php.ini, .htaccess, or user.ini)
- Ability to restart your web server (Apache, Nginx, LiteSpeed) if you change php.ini
- A text editor (Notepad++, VS Code, or even plain Notepad)
Step-by-Step
- Find your current limit. Log into phpMyAdmin, click on the “Import� tab, and look for the line that says “Maximum size: X KB� or similar. This is the current limit you need to increase.
- Locate your PHP configuration file. The exact file depends on your setup:
- Shared hosting (cPanel): Use the “MultiPHP INI Editor� in cPanel to edit the PHP settings for your domain.
- VPS/dedicated server: Find
php.ini(common paths:/etc/php.ini,/etc/php/7.4/apache2/php.ini, or/usr/local/lib/php.ini). - Local development (XAMPP/WAMP): Look for
php.iniin the installation folder (e.g.,C:\xampp\php\php.ini). - If you can’t edit php.ini, you can often use an
.htaccessfile in your phpMyAdmin directory (Apache only).
- Edit the relevant directives. Open the configuration file and search for these three lines (they may be commented out with a semicolon at the start):
upload_max_filesize = 2M post_max_size = 8M max_execution_time = 30
Change the values to what you need. For example, to allow a 512MB import:
upload_max_filesize = 512M post_max_size = 512M max_execution_time = 600
If the lines are commented out, remove the semicolon at the beginning. If they don’t exist, add them at the end of the file.
- Set memory limit (optional but recommended). For very large imports, also increase
memory_limitto at least 256M or 512M:memory_limit = 512M
This prevents PHP from running out of memory during the import.
- Save the file. If you’re using .htaccess, the lines would look like:
php_value upload_max_filesize 512M php_value post_max_size 512M php_value max_execution_time 600 php_value memory_limit 512M
Save and close the file.
- Restart your web server (if you edited php.ini). For Apache:
sudo service apache2 restart(orsystemctl restart apache2). For Nginx with PHP-FPM:sudo systemctl restart php7.4-fpm(adjust version). On XAMPP, restart Apache from the control panel. If you used .htaccess, no restart is needed—just refresh the page. - Verify the new limit. Go back to phpMyAdmin → Import tab. The maximum size should now reflect your new value. If it doesn’t, check that you edited the correct file or that the server is using the updated configuration.
Common Mistakes
- Editing the wrong php.ini. On some systems, there are multiple php.ini files (e.g., for CLI and Apache). Make sure you edit the one used by the web server. You can check with
phpinfo()inside phpMyAdmin (look for “Loaded Configuration File�). - Setting post_max_size smaller than upload_max_filesize.
post_max_sizemust be equal to or larger thanupload_max_filesize, otherwise the upload will fail with a “POST exceeds� error. - Forgetting to restart the server. Changes to php.ini are not applied until the web server or PHP-FPM is restarted.
- Using MB vs M. PHP accepts both, but be consistent. Use “M� for megabytes (e.g., 512M).
- Ignoring execution time. A large import can take minutes. If
max_execution_timeis too low, the script will time out even if the file uploads.
Tips
- Use a dedicated tool for very large dumps. If your file is over 1GB, consider using command-line tools like
mysqlormysqldumpinstead of phpMyAdmin—they’re faster and don’t have web server timeouts. - Compress your SQL file. phpMyAdmin supports gzip and zip compressed imports. A compressed file will be smaller, so it’s easier to upload and often imports faster.
- Split large files. If you can’t increase the limit enough, split your SQL dump into smaller chunks using tools like
splitor specialized scripts. - Check your hosting provider’s limits. Some shared hosts have hard caps (e.g., 64MB) that you cannot exceed. If so, you may need to upgrade your plan or use a different method.
Troubleshooting
- The limit still shows the old value. First, confirm you edited the correct php.ini (use phpinfo()). Then restart the web server properly. If you’re on shared hosting, the MultiPHP INI Editor may have a separate “PHP Settings� section—make sure you saved there.
- You get “POST exceeds� error. This means
post_max_sizeis too small. Increase it to at least the same asupload_max_filesize. - Import starts but times out. Increase
max_execution_timeto 600 or higher. Also consider increasingmemory_limit. - You see a 500 Internal Server Error after editing .htaccess. Your host may not allow
php_valuedirectives in .htaccess. Remove those lines and try using auser.inifile (if supported) or contact your host. - Changes don’t work on Nginx. Nginx doesn’t use .htaccess. You must edit the PHP-FPM pool configuration or the main php.ini, then restart PHP-FPM.
Frequently Asked Questions
What is the default phpMyAdmin import limit?
The default is usually 2MB (from upload_max_filesize), but many hosts set it higher, often 8MB or 16MB.
Do I need to increase both upload_max_filesize and post_max_size?
Yes. post_max_size must be at least as large as upload_max_filesize because the file is sent as part of a POST request.
Can I increase the limit without editing php.ini?
Yes, if your host allows .htaccess overrides, you can add php_value lines. On some hosts, you can also use a user.ini file in the phpMyAdmin directory.
Why does my import still fail after increasing the limit?
Check the PHP error log. Common causes: max_execution_time too low, memory_limit too low, or the SQL file has syntax errors. Also ensure the file is not corrupted.
Is it safe to set these values very high?
Setting them too high can cause server resource issues, especially on shared hosting. Use values that match your actual needs (e.g., 512M for a large database) and revert them after the import if possible.
What if my host doesn’t allow any changes?
Then you’ll need to use an alternative method: import via SSH with the mysql command, use a client like MySQL Workbench, or ask your host to temporarily increase the limit.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.