Making a Local Copy

From Zen Cart(tm) Wiki
Revision as of 01:34, 27 March 2006 by Dwno (talk | contribs) (added link to xampp)
Jump to: navigation, search

Making a Local Copy of Your Web Site

If your Web site is hosted on a remote server, it is common practice to have a parallel copy of the site on a local computer for development and testing.

This is not difficult, but requires certain preparation before the copy can be installed. Faster access than dial-up will be well worth the cost if available.


Preparation

First, you will need server software and accessories (Apache or other server, MySQL, PHP etc.) These can be installed individually, but if you have the skill to do that you probably don't need this guide. Numerous open source packages are available. [My experience is with XAMPP; anyone with knowledge of other systems should add that information, or discuss relative merits of systems in a sidebar.] To make local work most relevant to the remote site, it makes sense to choose software as similar as practical. You will probably also need a utility to extract zip or gzip files, again readily available in open source. Note: Zen-cart through v1.2.7 is not compatible with MySQL 5.x - see Troubleshooting-Errors-1054

Install the server package per the supplier's instructions (it will probably be quite simple.) It is good to locate it near the root (C:\ or C:\Program Files). If you mess up at any point you can uninstall or delete everything and start over. You will then want to create a database using phpMyadmin, probably accessible through the server admin. Don't worry about where it goes; MySQL takes care of that. Don't move the db or it will be lost. You will later import the downloaded db information from a .sql file or similar.

You will install the site files in a subdirectory you create in (probably) \< server >\htdocs\ or the like (sometimes referred to as C:\internet\). Phpinfo(?) will give Document Root, which is the part of the file path that will be replaced by http://localhost/ when typing your local site address in the browser.

Copying Files and Database from the Remote Server

If your remote site uses cpanel for access, there is a Backup page where you can download a backup of your entire server space in a gzip file with one click; however, you have no control of what is included. To download your database, phpMyadmin is accessible through a tiny link at the bottom of the MySQL page. It is very flexible, though the default settings will force the copy when imported to create another db named the same as the original. (It is possible to get around this if desired, e.g. making two copies locally, by editing the .sql file to remove the CREATE statement and change the ?SET and USE statements to your desired copy name.) [Someone please describe what settings will be good for various circumstances.][Also relevant info for other common interfaces.]

You will want to download an FTP client to transfer files. You can select exactly which parts of your webspace to copy. Be aware of the progress of selecting - depending on program, connections and settings it is possible to time-out in the middle of a long selection process, and picking up where you left off risks missing or misaligning some files.

Installing your site copy

[Copied from FAQs - tweak for this use] So, you want to move your site from an old host to a new one?

1. On your NEW host, create a new MySQL database. Note the username, password, database name, and host name (usually localhost).

2. Go to your NEW host and upload (FTP) a fresh NEW install using the same version files that you built your other site on.... this will make sure that you get the proper settings in your configure.php files.... While installing, allow it to install the demo products, so that you can test and be sure that it's working nicely. a. Install b. Test it. c. Make backups of the NEW server's /includes/configure.php and /admin/includes/configure.php files by downloading them (FTP) to your PC.


3. Make a COMPLETE backup of your DATABASE and STORE. a. Use either the "Backup MySQL Database" contribution under Admin->Tools to do the backup of your database, or use phpMyAdmin to export your entire database ... include the "DROP" tables command, and under Data, choose "Complete Inserts" and "Extended Inserts". Save the SQL file to your PC for later. b. Download all your old site's files via FTP (or if you have the option, zip them up on the server and download the zip)

4. Now upload your OLD files over the NEW files on the NEW server, WITH TWO EXCEPTIONS: Don't overwrite the /includes/configure.php and /admin/includes/configure.php files on the NEW server.

5. Go back to phpMyAdmin on your NEW server. a. Select your NEW database (that you installed the NEW Zen Cart into) b. DROP all the tables. (Check them all and scroll down and on "With Selected..." select DROP. Confirm Yes. c. Click on the SQL tab across the top and click Browse. d. Select the SQL file you made in step 3a when you exported your old database, and click Go.

6. Grab the "Fix_Cache_Key" utility to reset your Admin->Sessions->Session Directory key: http://www.zen-cart.com/modules/mydownloads/singlefile.php?lid=522 Simply upload the file to your NEW Zen Cart folder and open fix_cache_key.php in your browser. It will give you status messages. Delete fix_cache_key.php when you're finished.

7. You're done. Open your store and admin areas to see it all ready to go!