Zen Cart Logo
Forums / General Questions / Migrating entire site and Database

Migrating entire site and Database

Views: 1,251

Results 1 to 9 of 9
4 Apr 2014, 9:45 PM
#1
nadiausa avatar

nadiausa

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
82
Plugin Contributions:
0

Migrating entire site and Database

Hello,

I had a site built with a few products on a testing server at mysite.com/myFutureStore.
I installed a clean new Zencart on the root of the new server myNewDomain.com and it's fine.
Then I copied and saved the new configure files from the includes folder and admin>includes folder to my computer via FTP.
Then I FTP'd all the old site files to the new install.
Then I made sure to then FTP the configure files that I saved from the new install.

So far so good... New Site works, New Admin works. Obviously no products or data, just a clean store.

I went to PHPmyadmin for both old and new databases and make export backups of both.
Then I selected and dropped all the tables from new database.
Then I imported the old database to the new database.

Then I get a blank screen with the warning: WARNING: An Error occurred, please refresh the page and try again.

What went wrong?

I checked the configure files and they are from the new install.

Even if I install the fix_cache_key.php it won't let me run the page by typing in the page url mywebsite.com/fix_cache_key.php.

Is there something I can change manually n the data base fields?

In the past I have done a partial import of a new site without the some tables and had it work but this time I want to try and do it with a full drop and import replacement .

Regards,
Nadia

4 Apr 2014, 9:49 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Migrating entire site and Database

4 Apr 2014, 9:56 PM
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Migrating entire site and Database

Let us know what you find.

4 Apr 2014, 10:02 PM
#4
nadiausa avatar

nadiausa

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
82
Plugin Contributions:
0

Re: Migrating entire site and Database

I checked my logs and the first thing I saw was:

[04-Apr-2014 21:25:35 UTC] PHP Fatal error:  1146:Table 'frozensol_zc1.zc_configuration' doesn't exist :: select configuration_key as cfgkey, configuration_value as cfgvalue
                                 from zc_configuration in /home/frozensol/public_html/includes/classes/db/mysql/query_factory.php on line 120

So I restored the new install database and then dropped all the tables except configure. Then Imported the old database (without the configure table).

Then It still had the same blank(ish) page and I checked the logs again and now have this:

[04-Apr-2014 21:57:05 UTC] PHP Fatal error:  1146:Table 'frozensol_zc1.zc_product_type_layout' doesn't exist :: select configuration_key as cfgkey, configuration_value as cfgvalue
                          from zc_product_type_layout in /home/frozensol/public_html/includes/classes/db/mysql/query_factory.php on line 120 
4 Apr 2014, 10:12 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Migrating entire site and Database

NadiaUSA:

I checked my logs and the first thing I saw was:

[04-Apr-2014 21:25:35 UTC] PHP Fatal error: 1146:Table 'frozensol_zc1.zc_configuration' doesn't exist :: select configuration_key as cfgkey, configuration_value as cfgvalue
from zc_configuration in /home/frozensol/public_html/includes/classes/db/mysql/query_factory.php on line 120

> 
> So I restored the new install database and then dropped all the tables except configure. Then Imported the old database (without the configure table). 
> 
> Then It still had the same blank(ish) page and I checked the logs again and now have this:
> 
> ```
[04-Apr-2014 21:57:05 UTC] PHP Fatal error:  1146:Table 'frozensol_zc1.zc_product_type_layout' doesn't exist :: select configuration_key as cfgkey, configuration_value as cfgvalue
                          from zc_product_type_layout in /home/frozensol/public_html/includes/classes/db/mysql/query_factory.php on line 120 

Do your current configure.php files (new ones) have the table prefix zc_ ?

4 Apr 2014, 10:15 PM
#6
nadiausa avatar

nadiausa

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
82
Plugin Contributions:
0

Re: Migrating entire site and Database

Ah, strangley the new database tables prefix is zc_ and the old is zen_

How do I fix this?

4 Apr 2014, 10:19 PM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Migrating entire site and Database

NadiaUSA:

Ah, strangley the new database tables prefix is zc_ and the old is zen_

How do I fix this?

Either use sql to alter all of the tables in the new database after import of all the tables, or modify the configure.php files to have the database prefix as zen_ instead of zc_.

4 Apr 2014, 10:24 PM
#8
nadiausa avatar

nadiausa

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
82
Plugin Contributions:
0

Re: Migrating entire site and Database

YAY! I just changed the database prefix in the 2 configure files and did a new clean dump and import.

I didn't catch it was zc_ instead of zen_

Thanks!!!!!!!!!!!!!!!!

5 Apr 2014, 12:19 AM
#9
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Migrating entire site and Database

NadiaUSA:

YAY! I just changed the database prefix in the 2 configure files and did a new clean dump and import.

I didn't catch it was zc_ instead of zen_

Thanks!!!!!!!!!!!!!!!!

Glad you figured it out. Sorry that I identified the incorrect new/old configure.php file to look in for the prefix of zc_

To clarify for anyone that has happened across this thread in search of a solution, the OP had setup a new store and new database (ZC default) then brought all files from the old store and the database contents from the old store to the new store minus the two old configure.php files.

Generally speaking there would be no problem with that process; however, in creating the new store, a table prefix was applied that was different than the old store's table prefix. (Btw, ZC default/recommendation is to not include a prefix which would have completely prevented this problem, but we each have our reasons to have one or not.)

So, with the configure.php files expecting a prefix of zc_ and the database tables having a prefix of zen_, the code could not access the correct table information.

The tests that NadiaUSA did by not replacing the "problem" table one time identified that the new store accepted the new database structure for the one table, but didn't like the next table. This identified that the table structure was in question (table name(s)) I then referenced the prefix of the wrong store, but NadiaUSA was able to figure it out. That is/was also something covered in the link provided by stevesh which summed up everything I could think to ask. :)

Anyways, glad it's working for you now. :) happy Zenning!