Uh-oh! Unable to import siite

Issue Summary

I have just tried to create a local site using a backup from a web host but getting the above error. Details below:

Error: Command failed: /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+11/bin/darwin/bin/php /Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar --path=/Users/alanshaw/Local Sites/bridgetscakes-co-uk-2021-11-16-05-48-55/app/public --require=/Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/local-wpcli-error-reporting.php --skip-plugins --skip-themes --url=staging.bridgetscakes.co.uk search-replace --all-tables-with-prefix http://staging.bridgetscakes.co.uk http://bridgetscakes-co-uk-2021-11-16-05-48-55.local
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular?
    Just this one

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?
    Yes

Replication

Describe the steps that others can take to replicate this issue. If you have screenshots that can help clarify what is happening, please include them!

System Details

  • Which version of Local is being used?
    Version 6.1.5

  • What Operating System (OS) and OS version is being used?
    Mac Big Sur OS 11.6.1

  • Attach the Local Log. See this Community Forum post for instructions on how to do so:

Security Reminder

Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

That message about there being a critical error on the WordPress site usually means that there is some sort of PHP fatal error that is breaking WordPress and preventing Local from importing the site easily.

You might have to manually import the site by doing the following:

  1. Create a new site in Local.
  2. Unzip the site backup to a temporary location, for example on your Desktop.
  3. Replace the wp-content folder of the new Local site with the wp-content folder from the site backup.
  4. Copy the database dump (the file ending in .sql) to the site root located at sitename/app/public
  5. Within Local, right-click on the site and select “Open Site Shell.”
  6. Using wpcli, import the database.
  7. Using wpcli, update the domain within the database.

Those last two steps will look something like this within the terminal window that was opened:

wp db import database-dump.sql
wp search-replace '//example.com' '//example.local'

Can you give that a try and let us know how it goes?

Hi Ben,
Thank you for your comprehensive reply. Let me say first of all this was way out of my area of expertise so I am surprised I got as far as I did. The first error was down to me using incorrect syntax (missing out ‘//’ but I ran the last command again but it still errored. I’m hoping it’s some thing simple.

You have new mail.
/Users/alanshaw/Library/Application\ Support/Local/ssh-entry/qF05Sw4V5.sh ; exit;
alanshaw@AlansRetinaiMac ~ % /Users/alanshaw/Library/Application\ Support/Local/ssh-entry/qF05Sw4V5.sh ; exit;
-n -e
Setting Local environment variables...
WP-CLI: WP-CLI 2.5.0
Composer: 2.1.5 2021-07-23
PHP: 7.3.5
MySQL: mysql Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
Launching shell: /bin/zsh ...
alanshaw@AlansRetinaiMac public % wp db import bridgets_newsite1.sql
**Success:** Imported from 'bridgets_newsite1.sql'.
alanshaw@AlansRetinaiMac public % wp search-replace '//example.com' 'example.local'
**Error:** There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
alanshaw@AlansRetinaiMac public % wp search-replace '//example.com' '//example.local'
**Error:** There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
alanshaw@AlansRetinaiMac public %"

When I tried to launch site I got this, is it any help for troubleshooting?

Seems like you have an issue with the mu-plugin, wp-stack-cache.php

Like what @afragen – the error is likely due to the wp-stack-cache.php plugin.

You can open a file browser and navigate to that folder:

~/Local Sites/examplecom/app/public/wp-content/mu-plugins

From there, temporarily move that file outside of the site (like your desktop). This should allow you to run those wpcli commands to import the db.

Hi,First of all thank you everyone for your advice. Went down a few blind alleys so decided to start afresh and as can be seen from below all appeared to work. The bad news is if I try and open site from within Local it goes straight to my externally hosted site. I confirmed this by disconnecting from network whereby local site would not load.

"alanshaw@AlansRetinaiMac public % wp db import StagingDev.sql
Success: Imported from 'StagingDev.sql'.
alanshaw@AlansRetinaiMac public % wp db import StagingDev.sql
Success: Imported from 'StagingDev.sql'.
alanshaw@AlansRetinaiMac public % wp search-replace '//BridgetsCakes.co.uk''//BridgetsCakes.local'
usage: wp search-replace <old> <new> [<table>...] [--dry-run] [--network] [--all-tables-with-prefix] [--all-tables] [--export[=<file>]] [--export_insert_size=<rows>] [--skip-tables=<tables>] [--skip-columns=<columns>] [--include-columns=<columns>] [--precise] [--recurse-objects] [--verbose] [--regex] [--regex-flags=<regex-flags>] [--regex-delimiter=<regex-delimiter>] [--regex-limit=<regex-limit>] [--format=<format>] [--report] [--report-changed-only] [--log[=<file>]] [--before_context=<num>] [--after_context=<num>]
alanshaw@AlansRetinaiMac public % "


Hey @startingtopuff – Looking at that wpcli command, I think it might be missing a space between the domains.

I edited your reply to make the formatting a little easier to read, and here’s what I’m seeing:

I think you should be able to do a search and replace for this site using this command:

wp search-replace '//BridgetsCakes.co.uk' '//BridgetsCakes.local'

Give that a try and let us know how it goes!

Hi Ben, Thank you so much, it all appears to be OK now. the puzzling thing is when I ran the revised command it returned “Made 0 replacements”
| wp_users | user_login | 0 | SQL |
| wp_users | user_nicename | 0 | SQL |
| wp_users | user_email | 0 | SQL |
| wp_users | user_url | 0 | SQL |
| wp_users | user_activation_key | 0 | SQL |
| wp_users | display_name | 0 | SQL |
| wp_yoast_seo_links | url | 0 | SQL |
| wp_yoast_seo_links | type | 0 | SQL |
±-------------------±----------------------±-------------±-----+
Success: Made 0 replacements.
alanshaw@AlansRetinaiMac public %

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.