Back to Community

Fixing Common WordPress Localhost Import and Migration Errors

21 threads Sep 7, 2025 CoreLocalhost installs

Content

Working on a local WordPress installation is an excellent way to develop and test a site safely. However, a frequent point of frustration for many developers is encountering errors when trying to import demo content, migrate a site, or handle large XML files. Based on common community reports, this guide will walk you through the most frequent causes and their solutions.

Why Do These Import Errors Happen on Localhost?

Local development environments like XAMPP, MAMP, WAMP, or Local by Flywheel are configured for convenience, not necessarily for the high-resource tasks that theme demo imports or full-site migrations require. The errors you see are often protective measures triggered by server configuration limits or file permission settings that are too restrictive for these intensive operations.

Common Localhost Import Issues and Their Solutions

1. The Dreaded "Critical Error" or "Internal Server Error"

You try to run an import and are met with a generic "There has been a critical error" message with no helpful details, and crucially, no admin email is received.

  • Why it happens: This is usually a PHP memory exhaustion error or a script timeout. The process of importing hundreds of posts, pages, and images requires more resources than PHP is allowed to use by default.
  • The fix: Enable debugging to see the actual error. Edit your wp-config.php file and ensure these lines are present and set to true:
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true ); // Logs errors to wp-content/debug.log
    define( 'WP_DEBUG_DISPLAY', false ); // Hides errors from the screen
    After triggering the error again, check the wp-content/debug.log file for the specific error message. This is your most important clue.

2. "Server Permissions" or "Denies Access to import.xml" Error

Theme demo importers frequently throw errors stating there is a problem with server permissions preventing access to necessary files.

  • Why it happens: Your local web server (Apache, Nginx) does not have the correct read/write/execute permissions for the WordPress directory.
  • The fix: Adjust file permissions. For local development, you can often safely set permissions to 755 for directories and 644 for files. You may need to use a terminal or file manager to recursively apply these permissions to your entire WordPress installation folder. The goal is to ensure the user account running the web server process has ownership of the files.

3. Import Hangs or Fails at a Certain Percentage (e.g., 95%)

When using migration plugins like All-in-One WP Migration, the process seems to go well but then consistently fails near the end.

  • Why it happens: This is almost always a PHP configuration limit. The most common culprits are max_execution_time (script timeout), upload_max_filesize, and post_max_size.
  • The fix: Increase PHP limits. Locate your php.ini file (your local environment's admin panel often has a link to it) and increase the following values:
    max_execution_time = 300
    upload_max_filesize = 512M
    post_max_size = 512M
    memory_limit = 256M
    Save the file and restart your local web server (e.g., Apache, MySQL) for the changes to take effect.

4. The Infamous FTP Credentials Prompt

WordPress suddenly asks for FTP or SFTP credentials to install plugins, themes, or perform updates, even on your local machine.

  • Why it happens: The user account running your web server does not have file ownership over your WordPress files.
  • The fix: The simplest solution is to add one line to your wp-config.php file above the line that says /* That's all, stop editing! Happy publishing. */:
    define('FS_METHOD', 'direct');
    This forces WordPress to use direct file writing, bypassing the FTP prompt.

5. HTTP Loopback Connection Error (cURL error 28)

Some importers or plugins try to connect back to your local site (http://localhost...) and fail with a timeout error.

  • Why it happens: The local server cannot make a connection to itself, often due to DNS or firewall configuration within the local environment.
  • The fix: Try using a different local domain. Instead of http://localhost, use a full fake domain like http://mywebsite.local that you set up through your local environment's tools (e.g., Local by Flywheel makes this easy). This often resolves internal routing issues.

General Troubleshooting Checklist

  1. Enable Debugging: Always start here. The debug.log file is your best friend.
  2. Check PHP Configuration: Verify your max_execution_time, memory_limit, and file upload sizes are sufficiently high.
  3. Verify File Permissions: Ensure your web server can write to the wp-content directory.
  4. Disable Plugins & Themes: Rule out conflicts by disabling all plugins and switching to a default Twenty Series theme before running the import.
  5. Try an Alternative Migration Plugin: If one plugin fails (e.g., All-in-One WP Migration), try another like Migrate Guru or Duplicator, which can handle large exports differently.

By methodically working through these common issues, you can overcome the barriers to importing content on your localhost and get back to building your site. Remember, the specific error log is the key that unlocks the correct solution.

Related Support Threads Support