Database Uploads for WordPress with PHP: Difference between revisions
Jump to navigation
Jump to search
Created page with "...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?" |
mNo edit summary |
||
| Line 2: | Line 2: | ||
Solution? | Solution? | ||
= php.ini Settings for Large phpMyAdmin Database Imports = | |||
Large WordPress database imports through phpMyAdmin may fail when PHP upload limits, post limits, memory limits, or execution timers are too low. | |||
== Common PHP Settings == | |||
Recommended example for a large import: | |||
<syntaxhighlight lang="ini"> | |||
upload_max_filesize = 512M | |||
post_max_size = 600M | |||
memory_limit = 768M | |||
max_execution_time = 600 | |||
max_input_time = 600 | |||
</syntaxhighlight> | |||
{| class="wikitable" | |||
| ! Setting !! Purpose | | | | |||
| -------------------------------- | - | ------------------------------------------------------------------------------------------ | | |||
| <code>upload_max_filesize</code> | | Maximum uploaded SQL file size. | | |||
| - | | | | |||
| <code>post_max_size</code> | | Maximum total HTTP POST body size. Should be larger than <code>upload_max_filesize</code>. | | |||
| - | | | | |||
| <code>memory_limit</code> | | PHP memory ceiling. Should usually be larger than <code>post_max_size</code>. | | |||
| - | | | | |||
| <code>max_execution_time</code> | | Maximum PHP script run time, in seconds. | | |||
| - | | | | |||
| <code>max_input_time</code> | | Maximum time PHP may spend receiving input, including uploads. | | |||
| } | | | | |||
== phpMyAdmin-Specific Settings == | |||
In <code>config.inc.php</code>: | |||
<syntaxhighlight lang="php"> | |||
$cfg['ExecTimeLimit'] = 600; | |||
$cfg['MemoryLimit'] = '768M'; | |||
$cfg['UploadDir'] = 'upload'; | |||
</syntaxhighlight> | |||
<code>$cfg['UploadDir']</code> lets an SQL file be copied to the server first, then selected from phpMyAdmin, avoiding browser upload limits. | |||
== Per-Site Configuration == | |||
Depending on the PHP handler: | |||
<syntaxhighlight lang="apache"> | |||
# Apache module / mod_php only | |||
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 | |||
</syntaxhighlight> | |||
For CGI/FastCGI or PHP-FPM, use a per-directory <code>.user.ini</code> instead: | |||
<syntaxhighlight lang="ini"> | |||
upload_max_filesize = 512M | |||
post_max_size = 600M | |||
memory_limit = 768M | |||
max_execution_time = 600 | |||
max_input_time = 600 | |||
</syntaxhighlight> | |||
== Notes == | |||
* Restart or reload the web server / PHP-FPM after changing global PHP configuration. | |||
* Browser-based phpMyAdmin imports are convenient but not ideal for very large databases. | |||
* For very large SQL files, command-line MySQL import is usually more reliable. | |||
== External References == | |||
* [https://www.php.net/manual/en/ini.core.php PHP Manual: Core php.ini directives] | |||
* [https://www.php.net/manual/en/features.file-upload.common-pitfalls.php PHP Manual: File upload common pitfalls] | |||
* [https://www.php.net/manual/en/configuration.changes.php PHP Manual: How to change configuration settings] | |||
* [https://www.php.net/manual/en/configuration.file.per-user.php PHP Manual: .user.ini files] | |||
* [https://docs.phpmyadmin.net/en/latest/config.html phpMyAdmin Documentation: Configuration] | |||
* [https://docs.phpmyadmin.net/en/master/faq.html phpMyAdmin FAQ: Cannot upload big dump files] | |||
Revision as of 22:54, 3 June 2026
...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?
php.ini Settings for Large phpMyAdmin Database Imports
Large WordPress database imports through phpMyAdmin may fail when PHP upload limits, post limits, memory limits, or execution timers are too low.
Common PHP Settings
Recommended example for a large import:
upload_max_filesize = 512M
post_max_size = 600M
memory_limit = 768M
max_execution_time = 600
max_input_time = 600| | | | - | ------------------------------------------------------------------------------------------ | | | Maximum uploaded SQL file size. | | | | | | Maximum total HTTP POST body size. Should be larger than upload_max_filesize. |
|
| | | | PHP memory ceiling. Should usually be larger than post_max_size. |
|
| | | | Maximum PHP script run time, in seconds. | | | | | | Maximum time PHP may spend receiving input, including uploads. | | | |
phpMyAdmin-Specific SettingsIn $cfg['ExecTimeLimit'] = 600;
$cfg['MemoryLimit'] = '768M';
$cfg['UploadDir'] = 'upload';
Per-Site ConfigurationDepending on the PHP handler: # Apache module / mod_php only
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 600For CGI/FastCGI or PHP-FPM, use a per-directory upload_max_filesize = 512M
post_max_size = 600M
memory_limit = 768M
max_execution_time = 600
max_input_time = 600Notes
External References |