Local Community

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 […] [–dry-run] [–network] [–all-tables-with-prefix] [–all-tables] [–export[=]] [–export_insert_size=] [–skip-tables=] [–skip-columns=] [–include-columns=] [–precise] [–recurse-objects] [–verbose] [–regex] [–regex-flags=] [–regex-delimiter=] [–regex-limit=] [–format=] [–report] [–report-changed-only] [–log[=]] [–before_context=] [–after_context=]
alanshaw@AlansRetinaiMac public % "