Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jun 2008
    Posts
    328
    Plugin Contributions
    0

    help question How can I Duplicate Zen Cart shop directory (same server) ?

    As part of my attempt to devise a store update methodology, with minimal disruption to the live store, I would like to duplicate my Zen Cart directory (currently 'shop') along with its associated database.

    Since I am able to SSH into my web host and work from the command line, my first thought was to simply use 'cp':
    [FONT="Courier New"]~/public_html> cp -R shop testshop[/FONT]
    But then I realized that if I do only that, the newly created Zen Cart store (testshop) will be using the same MySQL database as the original shop.

    Which means that any changes to the database made in one store, will be automatically reflected in the other. This defeats the purpose of my duplicated testshop since I want to use it to test new products, while the real live store is operational and running, without customers being exposed to this.

    So, it seems that I need to duplicate not only the Zen Cart directory, but the associated MySQL database as well. I searched the subject and found two excellent articles:

    I have installed Zen Cart to a directory. How do I rename or move that directory?

    Is it possible to create/build a complete Zen-Cart setup on a test server and then install on a live server?

    But while they provide very helpful hints that what I want to accomplish is possible (and some cues about key files that need to be modified properly), they assume the same database name.

    My question now is: How do I duplicate Zen Cart's database (with a different name of course)?

    I know that my question may be a pure MySQL issue rather than a Zen Cart one, but aside from needing to check for any Zen Cart related "side effects", I am hoping that the answer given here may be helpful to other Zen Cart users who (re)search for an optimal "live update" strategy.

    Thanks,
    Daniel

  2. #2
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: How to Duplicate Zen Cart shop directory (same server) ?

    Once you have "cloned" all your files, and have what is a "duplicate" of all your code in a separate directory, you can use phpMyAdmin to make a copy of the database.

    When you have a duplicate of the database, all you need do is adjust your configure.php files in the cloned store to point to the new database.

    Before you "operate" your cloned store, you will probably need to run FIX CACHE KEY.

    This php file can be found in the Free Software Addons.

    After you have re-set the cache, your cloned store ought to work independently of your original store.

  3. #3
    Join Date
    Jun 2008
    Posts
    328
    Plugin Contributions
    0

    Default Re: How to Duplicate Zen Cart shop directory (same server) ?

    Quote Originally Posted by fairestcape View Post
    Before you "operate" your cloned store, you will probably need to run FIX CACHE KEY.
    Thank you very much for this tip, fairestcape. This is exactly the kind of Zen Cart specific information that I needed and I can't get from a general purpose MySQL newsgroup.

    I intend to eventually post in this forum a step-by-step HowTo that describes how to duplicate a Zen Cart store directory, including a duplicate (i.e. not linked) database. I hope that this will help others as much as other posters helped me so far.

    In the meanwhile here is a slight (but important) correction to the 'cp' shell command posted above:
    ~/public_html> cp -Rp shop testshop
    This correction will preserve the original store's permissions (important for security). It assume a Linux host.

    Also, here is a link to to FIX CACHE KEY add-on you mentioned.

    Lastly, here is another useful link that describes how to backup and restore the database, although it seems to me that this not really what you mean by "use phpMyAdmin to make a copy of the database". The reason is that it restores from backup to the exact same database, with the exact same name. Is my observation correct?

    If so, I think that what you were referring to by "use phpMyAdmin to make a copy of the database" is the "Copy database to:" in "Operations" tab in phpMyAdmin. Is this correct?

  4. #4
    Join Date
    Jun 2008
    Posts
    328
    Plugin Contributions
    0

    help question Re: How to Duplicate Zen Cart shop directory (same server) ?

    OK - I am so glad I am testing this before going live...

    I find DrByte's fix_cache_key.php incredibly helpful in duplicating the Zen Cart shop directory to testshop. However, I am having problems running it, perhaps because when I created the testshop database, using cPanel, the password in database user's password in:
    • admin/includes/configure.php
    • includes/configure.php

    No longer matches the password I specified for the newly created testshop database.

    How do I modify DB_SERVER_PASSWORD in both configure.php to match the password I specified when I created the testshop database?

  5. #5
    Join Date
    Jun 2008
    Posts
    328
    Plugin Contributions
    0

    red flag Re: How to Duplicate Zen Cart shop directory (same server) ?

    Quote Originally Posted by zcnb View Post
    How do I modify DB_SERVER_PASSWORD in both configure.php to match the password I specified when I created the testshop database?
    OMG - I can't believe it's so simple: the password specified in both configure.php files at the define('DB_SERVER_PASSWORD' line is stored in clear text...

    I just tried it and the fix_cache_key.php script worked!

    But now, I have a totally different question:

    Doesn't storing the database user password in clear text in the configure.php file constitute a potential security hole/risk?

  6. #6
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: How to Duplicate Zen Cart shop directory (same server) ?

    Quote Originally Posted by zcnb View Post

    Doesn't storing the database user password in clear text in the configure.php file constitute a potential security hole/risk?
    That's why you MUST chmod the files to at least 644 (or better to 444 which is what I do). If this is not done a warning appears in the browser when you visit the site.

    (Personal boast: My record for cloning a zenshop is just 11 minutes!)

  7. #7
    Join Date
    Jun 2008
    Posts
    328
    Plugin Contributions
    0

    Default Re: How to Duplicate Zen Cart shop directory (same server) ?

    Quote Originally Posted by fairestcape View Post
    That's why you MUST chmod the files to at least 644 (or better to 444 which is what I do). If this is not done a warning appears in the browser when you visit the site.
    Thank you for quickly addressing my concern. Indeed, I always make sure those files have their permissions set to 444.

    Still, 444 (as opposed to 440) means they are world-readable. Is this OK, in terms of security?

    Quote Originally Posted by fairestcape View Post
    (Personal boast: My record for cloning a zenshop is just 11 minutes!)
    I envy you. When I first started this project, I knew nothing about web technology (and much less about PHP/MySQL ...). I hope that by the time I am done, I will be able clone a zenshop in 111 minutes.

  8. #8
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: How to Duplicate Zen Cart shop directory (same server) ?

    The FAQ on copying data to/from an offline testing server, usually a PC, covers the same process, but instructs to use FTP to copy the files, since that's what most people have available to them. Most don't have SSH access let alone the knowledge to use command-line instructions on a Linux server.

    Basically the process is this:

    1. Clone the files. Since you're working on the same server and same hosting account, AND you have shell access to your server, using your command-line "cp" approach is fine.
    2. Edit the cloned configure.php files to contain the correct database details for your testing database.
    3. Use phpMyAdmin to export your live database using the FAQ instructions.
    4. Use phpMyAdmin to restore your database backup into the database used for your testing site.

    5. Since you're running on the same server and hosting account, it's unlikely that you'll need to use fix_cache_key.php on your site.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Jun 2008
    Posts
    328
    Plugin Contributions
    0

    Idea or Suggestion Re: How to Duplicate Zen Cart shop directory (same server) ?

    DrByte, thanks for the duplication process outline you provided here. I intend to post a detailed HowTo ("step-by-step" or a checklist) that may be able to help others in some pitfalls that I went through. It will be Linux (web host) specific, but I believe that it will help many Zen Cart users.

    Quote Originally Posted by DrByte View Post
    5. Since you're running on the same server and hosting account, it's unlikely that you'll need to use fix_cache_key.php on your site.
    Actually, I did need to use fix_cache_key.php in my case. In the first run its output was:
    Read DIR_FS_SQL_CACHE from configure.php: /home/myuserid/public_html/testshop/cache
    Found SESSION_WRITE_DIRECTORY in database: /home/myuserid/public_html/shop/cache

    Now synchronizing...
    Database now contains the following SESSION_WRITE_DIRECTORY:
    /home/myuserid/public_html/testshop/cache

    Finished.
    Thanks again for this helpful script!

  10. #10
    Join Date
    Aug 2006
    Location
    Wales
    Posts
    87
    Plugin Contributions
    0

    Default Re: How to Duplicate Zen Cart shop directory (same server) ?

    Hi,
    I've sort of cloned my shop, but I have no products in the categories.
    Everything seems to be working fine except for that.
    I copied my original shop files from my server to my desktop.
    Renamed them to the name I wanted them to have on the server, because this is a new site selling part of the inventory of the present shop.
    I had tried to do a straight copy over several times before but it just didn't work properly - couldn't see the shop no matter what I did - so I presumed there were some files not pointing to the right place but I was unable to fix it.
    This time I did a complete new install, then I copied the renamed old shop, minus the configure files, over the new install on the server.
    I then exported the old shop database, renamed it to the correct new shop database name, then imported the renamed database into the new shop's phpmysql place.
    Everything works great.
    I have the modules working properly and all the categories are there complete with their pictures etc.
    Now comes the problem - I have no products in the categories!
    No products, no pictures no nothing!
    Just the categories themselves, that's all!
    Where are the products kept?
    When the database was imported it had the right number of queries executed etc, all seemed to be there.
    All the files from the old shop were copied into the new shops folder, I even have fckeditor up and working, but no products.
    Can you help at all please?
    Steer me in the right direction?
    Any help would be gratefully received.
    Regards
    ###### Elston
    http://www.artyfactsforcrafts.com
    http://www.welshwiccashop.com

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 41
    Last Post: 30 Jul 2013, 05:43 PM
  2. On Shared Server and cannot see directory where zen cart is installed
    By thss.consultant in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 21 Feb 2010, 01:14 AM
  3. Second Zen Cart on same server for wholesale site
    By Martin Smith in forum General Questions
    Replies: 10
    Last Post: 15 Jan 2010, 10:59 AM
  4. How Do I Duplicate My Zen Cart Store To A New Server?
    By beefclothing in forum General Questions
    Replies: 1
    Last Post: 21 Jun 2007, 04:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg