Configuring wordpress to run on the desktop

Everytime I do a software update, I’m always a little paranoid of things going wrong, and the idea of having to manually tweak mysql databases due to an upchuck is not my idea of fun. Thus, I wanted to try out software updates, as well as plug ins, without messing up my live site.

The solution… either A, set up a clone subdirectory on my webhost for test purposes, or go local. I will say that since I’ve gone local, its a ton faster, and a whole lot easier. Ie, rather than test, download via ftp, edit the file, upload the changes via ftp, test, and repeat, is pretty onerous after a bit, as contrasted with using file save in notebook, followed by a browser refresh.

The key of course is getting everything to work, without a lot of messing around, and their are a number of ways to get tripped up, and its not exactly well documented.

So, here we go 🙂

FIrst, you need a webserver which runs on your desktop. Like many folks, I run wintel… and putting apache on a wintel box is a bit screwey. But alas, the folks over at CH software made it pretty easy with webserver on a stick… I must admit, I just use a directory on my hard drive, but the stick thing sure sounds like a great idea as well. Its not blazingly fast, especially when doing major mysql updates, but its a nice solid tool.

Next, you need to get some configuration information and files from your webhost… the idea is to have as close to as possible an exact mirror of what is online running on your desktop. For the most part, short of 2 modifications in a copy of ones online database, everything is identical.

1. make a new subdirectory on your desktop webserver. In my case, its g:\wos\www\inventorsgarage\blog4\  (ie, dont use the domain extension of com, or the www… when setting up the directory. You could if you wanted to, as long as you left out the periods, but why add extra redundant characters, especially since its local.

2. Use your ftp program to download a complete copy of your wordpress directory into that subdirectory…. in my case public_html/inventorsgarage/blog4/ will be copied to g:\wos\www\inventorsgarage\blog4

3. Next fire up phpmyadmin on your webhost… You need to look at the database used by wordpress, and write down the collation settings,  and any other customizations, so you can duplicate it on your desktop.

4. Make a backup of your wordpress database, and download it to your hard drive. In my case, the file is called invent21.mysql.gz.

5. Now, open up wordpress file called config.php in your favorite text editor, to get the database details. Here are mine for example… although they have been changed… such data does not belong in the public domain, as it would be a huge security risk.

define(‘DB_NAME’, ‘invent21’);    // The name of the database
define(‘DB_USER’, ‘inVentor997’);     // Your MySQL username
define(‘DB_PASSWORD’, ‘123BoTylkFG’); // …and password
define(‘DB_HOST’, ‘localhost’);    // 99% chance you won’t need to change this value
define(‘DB_CHARSET’, ‘utf8’);
define(‘DB_COLLATE’, ”);

Ok, so now its time to have some fun on the desktop.

6. First you need to create a database using phpmyadmin on the desktop. The WOS startup screen has a convenient link right to phpmyadmin. Make sure you use the same database name as called out in wordpress’s config.php, and the collation info as found in step 3 above.

7. Next use phpmyadmin to create the user as called out in step 5, ie in my case inVentor997, and then grant that user all privileges, being you will be running on your desktop, security is no where near the concern it would be if you were live.

8. Then use phpmyadmin to import the database backup into the database you created in step 6. In my case, I would import invent21.mysql.gz. Bear in mind, that if your blog is massive, phpmyadmin does have size limitations, and you might need to use something like bigdump if you hit a wall with phpmyadmin.

9. Next, you need to modify two database records on your desktop. WordPress has a home url location, and a site url location. If you do not modify those, when you fire up wordpress locally, it will come up for a flash, and then send you to the online version, rather than the desktop. They are location in the wp_options section of the desktop database )step 6… (you may have a custom prefix, and thats ok… they are in wp_options with or without a prefix). Change those records from something like to wherever your local website is. in my case http://localhost/inventorsgarage/blog4/

10. Lastly point your browser to http://localhost/inventorsgarage/blog4/ and you should be good to go with a local copy of wordpress running on your desktop.

11. Periodically, you may want to copy your online database to your desktop version, and what I do, is delete the current desktop database, and reload from scratch, although if one is handy with phpmyadmin you may be able to just add the new records. Just make sure the site and home url records are updated.

Its great to run wordpress locally, being its so easy to try things, and revert back using windows explorer if something goes wrong… all the while the online version just continues to run happily along. And then once you are happy with the desktop version, its a simple matter to ftp the changes to the online verion. Do keep in mind that the databases will likely not be in sync, and thus you need to do some configuring in the online version, as far as turning on widjets, or other plug ins… but this way, you know what you are up against, rather than dealing with unknowns on a live site.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

SEO Powered by Platinum SEO from Techblissonline