Database Uploads for WordPress with PHP

wiki.TerraBase.info
Revision as of 22:57, 3 June 2026 by Root (talk | contribs)
Jump to navigation Jump to search

...wanna import a big database file for WordPress using phpMyAdmin? Good luck. The default settings PHP settings in php.ini will likely prevent that.

Solution?

Change some settings in /etc/php.ini (or other locations like /opt/remi, if using REMI for multiple PHP versions.

PHP Settings for Large phpMyAdmin Imports

Large WordPress database imports through phpMyAdmin can fail when PHP upload limits, POST limits, memory limits, or execution timers are too low.

Main php.ini Settings

upload_max_filesize = 512M
post_max_size = 600M
memory_limit = 768M
max_execution_time = 600
max_input_time = 600
upload_max_filesize
Maximum size of an uploaded SQL file.
post_max_size
Maximum total HTTP POST request size. Set this larger than upload_max_filesize.
memory_limit
Maximum memory PHP may use. For large imports, set this larger than post_max_size.
max_execution_time
Maximum script execution time, in seconds.
max_input_time
Maximum time PHP may spend receiving input, including uploads.

phpMyAdmin Settings

These go in phpMyAdmin's config.inc.php file.

$cfg['ExecTimeLimit'] = 600;
$cfg['MemoryLimit'] = '768M';
$cfg['UploadDir'] = 'upload';
$cfg['ExecTimeLimit']
phpMyAdmin execution time limit.
$cfg['MemoryLimit']
phpMyAdmin memory limit override.
$cfg['UploadDir']
Allows SQL files to be copied to a server-side upload directory and selected from phpMyAdmin, avoiding browser upload limits.

Per-Site Configuration

If PHP runs as an Apache module, settings may be placed in .htaccess:

php_value upload_max_filesize 512M
php_value post_max_size 600M
php_value memory_limit 768M
php_value max_execution_time 600
php_value max_input_time 600

If PHP runs through CGI, FastCGI, or PHP-FPM, use .user.ini instead:

upload_max_filesize = 512M
post_max_size = 600M
memory_limit = 768M
max_execution_time = 600
max_input_time = 600

Notes

  • Reload or restart the web server or PHP-FPM service after global PHP changes.
  • For very large databases, command-line import with mysql or mariadb is usually more reliable than browser upload through phpMyAdmin.
  • Web server limits may also apply, such as Apache request limits or Nginx client_max_body_size.

References