How can I import a site into Local by Flywheel

I’m using Local by Flywheel. Everything is local. The wp-config.php is pointing to the local db. It really bothers me that I am not getting ANY log entries written. It makes me think that the database error is misleading, because if it really got that far, it should have written some logs.I feel like something more basic is going on, but I can’t see what.

There’s a pretty active support forum you should take this up with:

I’ve used this before.

Bud

Sorry, I’m a bit confused. Aren’t I in that very support forum now? I chose to append to this topic rather than start a new one because this all seemed to be about issues relating to importing a site into the Local product. Should I start a new topic instead?

1 Like

Yes you are in the support forum.
Just make a new topic regarding your problem :slight_smile:
Clay or the local team will sure help out.

Can you maybe send the zip file you are trying to import?
Also what version of local are you on and what OS ? :slight_smile:
This also would help.

Hey guys,

I’m not a WordPress expert, so bear with me on this question. My developer sent me the wordpress theme along with the .sql file. The .sql file does not have default localhost environment setups. The table prefixes are not wp_ etc… I’ve tried the import method but I get the “error establishing connection” message. I’m guessing the wp-config is not setup to connect the the db he sent over. I’ve adjusted table prefixes, changed usernames etc, but nothing seems to work. Can you guys help me out? What am I missing here?

How do you import sites you have when you had to delete ‘local by flywheel’ program and downloaded another LBF program?

Hey @blowabs ,

if you previously exported the sites before removing Local, you should be able to simply drag the zip file backups over Local and it’ll begin the import process.

Thanks,
Chris :slight_smile:

No. This world files I hAre pages and I want to import them.

Hi Allan,

I apologize but I’m not sure what you mean by that.

When you upgrade Local, all existing sites should still be there. If you uninstalled prior to upgrading, all Local data will be removed. In that case, you’ll need to do the following: How can I restore a site from a Local site folder?

Clay.,.

Unfortunately I didn’t export the files Before removing local . I just made a copy. Can you help me out from now because I’m trying to set up a new site and drag the old site folders in but I’m getting an error page. Thank you very much

~~Allan Michael
http://www.allanmichaelphotography.com/
http://www.terraingallery.org/archive/NYC-Photoshow-2011/Allan_Michael_2011.html

If it helps anyone
I tried it with backupbuddy
created an apache custom site
it failed with an error
so i went into the htaccess and re set it to wordpress standand htaccess settings.
see here: https://codex.wordpress.org/htaccess
then went back and reloaded the page.
wordfence and other plugins had re written a lot of crap in the htaccess file
hope this helps

bo

I’ve had great success using a plugin. It’ll generate a .wpress file that you can d&d into local site.

3 Likes

Did this ever work out for you? I’ve spent hours and hours trying to import a copy of my live file (in .zip format) into Local. The closest I’ve gotten is when it launches but sends me to the actual live site. And I have no idea what to edit and change to make it stop.

Ana here suggests using Sequel Pro. I downloaded and installed it, but Local ignores it, and I have no idea how to make it edit the options she mentioned in the wp_options table.

I read what I thought was an excellent intro to Local here (https://crunchify.com/local-by-flywheel-vs-mamp/) but it only got me so far. Now I;m stuck at the last hurdle, it seems.

It’s truly puzzling that there is no single introductory article to explain the steps to go from a live site to a Local site (using Mac).

Any help would be GREATLY appreciated.

For what it’s worth, to make the backup/clone of the original site I’ve used and failed with Duplicator (my host wouldn’t allow a large additional copy of the site online, I think); with Updraft Plus (not sure why). Now I’m using BackWPUp, but this necessitates resaving the output file .ghz as a .zip by first opening it and then recompressing all the individual components. I have a headache even trying to remember all the various steps. But still it doesn;t work! And what makes it crazifying is that setting up a new, ‘blank’ site with Local takes only seconds.

Hello fouadhousni:

I think I can be of assistance here. I ran into the same dilemma as you. I wanted to install a copy of a site hosted on a remote server (production site) and bring it down into Local by Flywheel.

I’ve used Duplicator in the past, and had a good experience with it using a different local development application. I’ve not used UpDraft Plus before, although I’m acquainted with the product name and know that it’s in wide use.

I’m going to talk to you about my recent experience using a different site migration product; iThemes BackUpBuddy (BUB) (https://ithemes.com/purchase/backupbuddy/). I was able to successfully migrate a backup of my production site into LBF this past weekend. Bear in mind that BUB requires a paid license. I think a single-site license is $80/year. I just bought a 10-site license for $100. The company often offers up to 35% discounts on multi-site license purchases. So the unit cost per active license is actually quite reasonable. The upside of using this product is it’s in regular development and well-supported.

Local is different than other local development environments you may have used previously. It runs in a contained environment (using Docker) within a virtual machine (Varying Vagrant Vagrants) on top of (separate from) your operating system. That allows each site created in Local to run an entirely different server setup.

BUB creates a backup archive of site files and database. It also generates a PHP migration script called ‘importbuddy.php’. When using BUB, one must delete all the existing WordPress files in the target site before before starting the migration process.

Let’s assume you’ve made a backup of your remotely hosted site with BUB, and downloaded the archive and importbuddy.php to your computer’s Downloads directory.

Create a new site in Local. Then create a new project in your integrated development editor and link the project to the WordPress files in your newly generated site. (I use PHPStorm as my IDE. Use whatever you’re comfortable with).

Open the front end of your newly created site from Local in your browser.

Then go into your project in your IDE and delete all the WordPress files within your project root directory ( ‘/{name-of-project}/app/public/‘ ). DO NOT DELETE THE DATABASE. [I think it’s named ‘db.php’.] You’ll need to overwrite the DB using importbuddy (IB). Add in the BUB archive file AND IB to your project root directory.

Open the browser tab that points to the Local site installation (e.g. {my-local-site.local} ). Add the term ‘/importbuddy.php’ to the URL. For example, ‘{my-local-site.local}’ becomes ‘{my-local-site.local}/importbuddy.php. Refresh the browser to run the script.

IB will open the archive zip file in the IDE. In the browser, you will be prompted for your IB password. Make sure if using BUB that you’ve saved this PW in a PW manager (I store my PWs in LastPass. Use whatever you’re comfortable with.

Then it’s just a matter of following the screen prompts for BUB. Step 3 is the trickiest of them all. The DB settings for the archive zip file will be shown. You’ll be prompted to either reuse those DB settings, or assign new ones. Just enter the DB settings set by Local (e.g. DB_HOST => ‘localhost’; DB_NAME => ‘local’; DB_USER => ‘root’; DB_PASSWORD => ‘root’). You can either accept the value for the DB $table_prefix variable from your imported site, or assign a different one (e.g. ‘wp_’ ).

There’s a checkbox to drop existing DB tables from the Local database, and overwrite those tables with new tables from your imported site. Select the checkbox to enable the feature.

If the DB migration proceeds smoothly (it should go quickly), then you’re home free and the migration will proceed.

When you complete the migration and look in your project files, you’ll see that BUB unpacked all of the WP files from your archive zip package.

Word of caution: Duplicator may alter your site’s .htaccess file. That file is relied upon by the Apache web server to build your permalinks. If you get some weird error messages from BUB during the DB migration, go look in your IDE at the .htaccess file.

If you need to rebuild that file, go to the WordPress Codex and search on ‘htaccess’ (https://codex.wordpress.org/htaccess). Copy and paste the code for that file into your .htaccess file.

Drop any versions of .htaccess that Duplicator might have generated from previous migrations (they may have extensions added to them like ‘.orig’). Just delete those file copies as you won’t need them for your local dev site.

Hope this helps you, or someone else reading this.

Hello fouadhousni:

The situation you’re running into where URL references in your local dev site redirect to your live site means that you’ve got serialized PHP strings in your local DB that are still pointing to your remotely hosted site. Plugins like Duplicator and BackupBuddy involve a step to take care of that for you.

However, if for any reason you need to inspect and changes those serialized URL strings, use the product make by ‘interconnectit/‘ in the UK. Do a dry run on your site first to check how many strings are affected before you run the actual PHP script.

With great power, comes great responsibility. If you do a live run with the script and make a mistake, there’s no going back. Hence, do a dry run first. https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

Sincerely,

Robert G.

Exact tcloving thank’s :wink:

Hello. I’ve just installed Local by Flywheel on Windows 10 and I had a tough time importing a site that had previously been in XAMPP.

After following instructions found on this page I found that after clicking on ‘Start site’ I’d get taken to ‘page not found’ - the url was a mixture of the new local url and the old path to the xampp site e.g. my-new-site.local/sites/wordpress-sites/myOldWebsite/.

My solution was as follows:

  • select/click on .sql and wp-content and create a .zip file.

I also renamed the zip file to archive.zip (this is probably not necessary but I’m doing it anyway).

  • Drop archive.zip into the Local by Flywheel window

  • Important: make sure, under ‘Advanced’ tab that you have the same url as the one you put in the .sql file (e.g. my-new-site.local). If it’s different, change it!

  • Click on admin and login with original credentials (those you used for your Xampp version)

  • Important: Save permalinks!

  • Visit site

It worked for me :slight_smile:

Hope this comes in useful for someone else!

1 Like

This is exactly what I need. I will attempt this step by step later and give a confirmation if it works or not :slight_smile: Thank yoU!

Hope it works! :slight_smile: