Back to Community

Fixing WordPress Importer Timeouts, Memory Errors, and Upload Limits

39 threads Sep 7, 2025 PluginWordpress importer

Content

Many users encounter issues when trying to import large XML files into WordPress using the WordPress Importer plugin. Common problems include fatal memory errors, HTTP timeouts (408, 500, or 413 errors), upload size limits, and incomplete imports. These are not necessarily bugs in the plugin itself but are often related to server configuration limits. This guide will explain why these errors occur and provide the most effective solutions to overcome them.

Why Do These Errors Happen?

The WordPress Importer plugin performs a resource-intensive process. It must parse a large XML file, create database entries for every post, page, and comment, and often download and process numerous media files. This requires significant amounts of server memory (RAM), CPU processing time, and temporary disk space. If your server's PHP configuration or web server settings have low limits for any of these resources, the import process will fail.

Common Solutions and Workarounds

1. Increase PHP Memory and Execution Limits

The most common errors are "Fatal error: Out of memory" or "Allowed memory size exhausted." This means the import process needs more RAM than your server currently allows. To fix this, you need to increase your PHP limits. The key settings to modify in your php.ini file are:

memory_limit = 256M
max_execution_time = 300
max_input_time = 300
upload_max_filesize = 64M
post_max_size = 64M

Important: After changing these values, you must restart your web server (e.g., Apache or Nginx) for the changes to take effect. If you don't have access to php.ini, you can try adding these lines to your WordPress wp-config.php file:

define('WP_MEMORY_LIMIT', '256M');
set_time_limit(300);

2. Compress Your XML File

If you cannot increase your upload_max_filesize, a clever workaround is to compress your XML file. The importer can process .gz (gzip) compressed files. A 20MB XML file might compress down to a 2MB .gz file, allowing you to upload it within a lower size limit.

How to do it: If you have 7-Zip (Windows) or gzip (Linux/Mac) installed, simply compress your XML file. Right-click the file, select compress, and ensure the output is a .gz file. Then, upload the compressed file through the importer.

3. Split a Large XML File into Smaller Chunks

For very large imports (over 50MB), even with high server limits, the process can time out. The most reliable solution is to split your WordPress export (WXR) file into smaller pieces. You can use free online tools or desktop applications called "WXR File Splitters" to do this. Import the smaller files one by one. This approach is highly recommended for imports containing thousands of posts or media items.

4. Check Your Server's /tmp Directory

During import, especially with many media files, the plugin uses the server's /tmp directory for temporary storage. If this directory runs out of space, media imports will fail with "Zero size file downloaded" errors. If you have server access, check the available space in /tmp. Freeing up space or configuring your system to use a different temporary directory with more space can resolve this.

5. Verify the XML File Integrity

Sometimes, an export file can become corrupted, leading to errors like "Premature end of data in tag." If you see these errors, try re-exporting your content from the source website. Ensure the export process completes fully without interruption.

Summary of Key Configuration Directives

Setting What it Does Recommended Value
memory_limit Maximum RAM a script can use 256M or higher
max_execution_time Maximum time a script can run (seconds) 300
upload_max_filesize Maximum size of a single uploaded file 64M or higher
post_max_size Maximum size of total POST data Must be larger than upload_max_filesize

If you continue to experience issues, please check with your web hosting provider, as they may enforce hard limits on these values that cannot be changed in your own php.ini file.

Related Support Threads Support