copying from remote to local host
-
I have downloaded wordpress2 on the remote (host) server and it is working fine. To test changes, I have downloaded wordpress2 from the remote (host) to my local wamp server environment. When I attempt to load the admin page, I get the following screen “error establishing data base connection”. Does someone know how to get around this? Thanks in advance. Bob
-
Essentially you need to follow the steps in Moving WordPress.
Also review Installing WordPress on your own computer.
The process in general is:
1. Install something like XAMPP on your local computer.
2. Create the database and user (probably be root) for WordPress
3. Copy down the files from your server and put in the correct folder on your local machine
4. Backup the database on your host and restore that to your local database.The following may be of use to those (like me) that have a hard time filling in some of the gaps in the instructions referenced above.
Mod, feel free to retitle/move if you think this is useful or better off elsewhere.
—————-8<———————————————–
Here’s a little project you guys and gals may be interested in…
What will you do if teh Internet tubes get clogged?
We know that we can spider and readily back up any website online to our local hard drive for show and tell where there’s no internet using great tools like HtTrack (https://www.httrack.com/ for Linux and PC)
[i]But what about that blog that you’ve lavished such care and attention on?[/i] HTTrack files take up a lot of room, and it’s not as if you can just download your SQL database and WordPress files and run them. You need to install and configure a webserver, PHP, and a copy of MySQL. And that’s a pain, and it means your local copy is stuck on your hard drive if you go with something like XAMPP.
But what if there was a way to take your blog anywhere, make multiple copies, and distribute it to the unwary? Yes, Virginia, it is possible.
The instructions online on how to do this are full of gaps to the uninitiated though as I recently discovered. So since I recently undertook to do this and actually succeeded, here’s a step-by-step that should save you a lot of headaches if you want to do this as well. The following instructions are for WordPress and the PC operating system, but if you self-host Blogger, something similar should be feasible. I challenge someone to create similar instructions for Mac and Linux, the idea is the same, but I don’t know the details. Mind you if you’re a Linux user you probably know how to do this anyways. 8)
MIRROR AND DISTRIBUTE YOUR BLOG ON LOCAL USB MEDIA
(This may work on DVD as well, have yet to try that…)1. Download the Mobile Web Server Project – https://www.chsoftware.net/en/useware/mowes/mowes.htm
Click through to the download page and select “I do not have a MoWeS Portable II Package and want to obtain a new package”
You’re going to want to select the following packages as part of your custom distro– MoWeS Portable II Core
– Apache2_SE (Version 2.2.11)
– MySQL5_SE (Version 5.1.30)
– PHP5_SE (Version 5.2.’8′)
– PHPMyAdmin (Version 3.1.2)Download this, extract it to your USB key, and run it by clicking the mowes.exe icon in the MoWeS directory. The ‘installation’ routine merely expands the archived packages within the USB key, so make sure you ‘install’ all packages. Note that after a successful installation, the *.pck file for PHPMyAdmin stays in the directory for some obscure reason (Eg; a bug), and you’ll want to delete it so you’re not bugged to install it every time you run MoWes.
2. Create a new local SQL database
Since your posts, settings, comments, tags, and all content are stored in SQL, you need to create a fresh local database to import your online data into.
With MoWeS running – its window must indicate that Apache and MySQL are both running – open your browser. Type localhost into the address bar. Click the PHPMyAdmin link on the MoWeS home screen. To create a new database, under “Create new database”, type in “wordpress” (to keep things simple) and click Create. Exit PHPMyAdmin.
3. Download your WordPress files to MoWeS directory.
Fire up your FTP software and download your WordPress hierarchy. If you don’t know how to do this, ask your ISP since you really should be backing up these files anyways. Note if you’re running WordPress 2.7, this directory should be something like \www\myblog.com\ and will contain the following directories (images, wordpress, wp-admin, wp-content, wp-includes) and a bunch of files. It’s important you get everything. Put all these files and directories into a new directory with the same name in the \www\ directory of your MoWeS installation. In other words, if your remote ISP directory is \\www\myblog.com\, copy to, F:MoWeS\www\myblog.com\ if your USB key is F drive. Naming this directory to the same domain as your blog is crucial to preserve links within your blog. In fact, why not call the MoWes top directory ‘myblog’ as well for the users, for USBDRIVE:\myblog\www\myblog.com\ as the location to dump the WordPress files into.
4. A Quick Edit to wp-config.php
Don’t panic, this is easy. In your new local \www\myblog.com\ directory, open the file wp-config.php in notepad or something that makes it nicer to edit, like the free Notepad++. Change the top few lines to look like this, then save it.
define(‘DB_NAME’, ‘wordpress’); // The name of the database
define(‘DB_USER’, ‘root’); // Your default MySQL username
define(‘DB_PASSWORD’, ”); // …and password. Note this is two single apostrophes, not a single quote
define(‘DB_HOST’, ‘localhost’);Save, then shut down, end, and restart MoWeS.
5. (Optional) Does your blog have a LOT of data? Edit php.ini
Back up to USBDRIVE:\myblog\php5\php.ini, open it in your editor, and search for the following lines.
“post_max_size”
and
“upload_max_size”Change these to a sufficiently large value. I had to use the following so that PHPMyAdmin would allow me to import my large database.
post_max_size = 64M
upload_max_size = 64MSave php.ini, then shut down, end, and restart MoWeS.
6. ‘Install’ WordPress
In your browser address bar, type https://localhost/myblog.com/wp-admin/install.php
Run through the WordPress install routine. Type in the name of your blog as it appears in your remote WordPress dashboard. After the install, if you go back to the address, you’ll see the fugly default WordPress installation, along with a sample first post.
7. Erase and re-create that SQL database.
No need to keep that default post and settings hanging around. Go into PHPMyAdmin like you did in Step 2. Click wordpress on the left side to select the wordpress database. You’ll see some tables have been created in it by the installation. On the top of the screen, you’ll see a tab marked Drop. Use it to delete this database. Thous shalt execute Step 2 again Brother Maynard, and proceed to Step 8.
8. Back up your REMOTE WordPress database.
This is a snap using WordPress 2.7. On the REMOTE WordPress dashboard sidebar, under Tools, pick Backup. Note that it auto-selects core WordPress tables for backup. If you have any other custom tables, click them as well since they probably have to do with your forum, etc, plugins. Backup and save to your desktop. The file will be a collection of letters and numbers ending in .sql.gz
9. Gently massage temples, then gently massage your SQL tables.
Using Winzip, unpack this file. Load the resulting .sql file into your favourite text editor. Again, Notepad++ will display it a lot nicer than Notepad. Also, if the file is too large, Notepad may well crash for the following operation.
Automatically find and replace all instances of “https://myblog.com/” with “https://localhost/myblog.com/” in order to direct any hyperlinks on your blog back to the [i]local copy[/i] rather than the web. Of course, to be clear, you substitute myblog.com with whatever your domain is, eg; statismwatch.ca, and remove the quote marks.
10. (Getting there) Import your SQL tables
Go back into PHPMyAdmin as in Step 2.
Click ‘wordpress’ in the list of databases on the left side of the screen. It should be empty of tables. Next click the Import tab at the top of the screen. Under File To Import, browse to the .sql file we messed with in the prior step. Click Go and wait.
11. Fix your wp_options siteurl to point to localhost
Still under MyPHPAdmin, you should now be able to see a bunch of tables in the left hand column. Click wp_options. See the first entry called ‘siteurl’? Click the little pencil icon to edit it.
Change it from https://myblog.com/ to https://localhost/myblog.com/ and click Go at the bottom of the screen. Don’t mess with any of the other values.
12. Doublecheck your URLs in the Dashboard
Let’s see if this worked. In your address bar, type in https://localhost/myblog.com/wp-login.php
Use the same username and password as you would for the REMOTE copy, since these are stored in the SQL database. Login and go to your General/Settings tab in the sidebar. Make sure the WordPress Address URL and Blog address URL are both now set to https://localhost/myblog.com/
13. Doublecheck to sure your Theme is activated
This should be ok, but since I had to mess around a bit before I came up with this step-sequence, just go into Appearance/Themes on the WordPress sidebar and activate the stylesheet for your blog if it’s still set to the default.
14. Make it easy for the people
In the root directory of your USB key, drop a shortcut to MoWeS.exe, but rename it to something like MyBlog_ClickMeFirst. Then drop a URL shortcut to https://localhost/myblog.com/ and rename it MyBlog_ClickMeSecond.
15. Visit your site!
Unplug your Internet connection just for yuks and try the shortcuts. You’re done! Make copies of your site and distribute widely. 8)
akston
https://statismwatch.ca
- The topic ‘copying from remote to local host’ is closed to new replies.