Create a test section to upgrade

Hi, I know many site owners have a copy of their store running on a sub domain for testing. I'm afraid if I upgrade I will have a lot of problems and would like to fix them before it goes up.



I know how to create a sub domain and I can copy everything from public_html into it but do I use the same database?



If someone could take the time to write a step by step on how to set a test or dev section that would be really appreciated.



Thank you,



D.

You can't upgrade the sub-domain using the same DB or you will break your production site.

Copy the current DB and then setup your sub-domain config.local.php to use the new DB.



Go through your upgrade process in the sub-domain making a copy of ANY file you end up changing.

When you're done and happy, go upgrade your production site and then simply copy back the files you saved.



Your production site should then be upgraded.

Get rid of the sub-domain (or sub-directory).

Thank you so much for your reply, you are always so helpful.


  1. I`ll create dev.mydomain.com and password protect it.
  2. Upload all files to it.
  3. I`ll make a copy of the database and call it something
  4. I`ll make the required changes on config.local.php to connect to the copied database
  5. Do all upgrades and test.
  6. When satisfied, upload all changed files back on the production site.



    You mention to delete the sub folder, couldn`t I just keep it for future testing.



    Thanks,



    David

[quote]You mention to delete the sub folder, couldn`t I just keep it for future testing.[/quote]



You are absolutely correct! :)

Thanks a lot for confirming Struck, I'm working on it.



D.

[quote]

6. When satisfied, upload all changed files back on the production site.

[/quote]

Subtle points

  1. you need to keep a local copy of any files you changed in your sub-domain AFTER you did the upgrade (I.e. local modifications).
  2. you need to go through the upgrade process on your production site, THEN
  3. copy your changed files ONLY to your upgraded production site.



    Regarding the sub-domain. If it is outside of your store, then yes, you can keep it. If it's in the directory of your store as a sub-folder, I would suggest deleting it. Too much risk of a customer getting there (but you've PW protected) and too much risk of a bot indexing the directory (which you don't want and would also get caught by the password protection).



    If you know what you're doing and have taken appropriate precautions, then sure, you can leave it. But for most merchants, I strongly recommend they delete it.

Hi, would you recommend keeping a testing site on a different domain instead of a sub domain? Let say I had a developer working on the site, shouldn't he work from the testing site and should this be a sub domain?



Thanks for your help.



D.

absolutely, if that's an option for you…

Doesn't matter if it's a sub-domain as far as I can tell.

The goal of a test system should be to be using the same configuration as production.

That's why they're usually on the same server in the same home directory so that Apache/PHP versions/configs are the same.

But if you can ensure this otherwise, then go for it.



A developer will appreciate having a test area to work in. Shouldn't matter what the domain is… And I don't think cs-cart cares either as long as the site is not publicly available.

If it's all the same, I'll keep it as a sub domain so that all server config are the same and all. Thanks again for your input.

I made a sub domain, dev.domain.com then uploaded all files into it. Next, I downloaded a copy of the database from my cPanel as an SQL file. Then on phpmyadmin I imported the newly named database and got this error:



-- Database: `databasename`
--
-- --------------------------------------------------------
--
-- Table structure for table `cscart_access_restriction`
--
CREATE TABLE IF NOT EXISTS `cscart_access_restriction` (
`item_id` mediumint( 8 ) unsigned NOT NULL AUTO_INCREMENT ,
`value` varchar( 66 ) NOT NULL default '',
`ip_from` int( 11 ) unsigned NOT NULL default '0',
`ip_to` int( 11 ) unsigned NOT NULL default '0',
`type` char( 3 ) NOT NULL default '',
`status` char( 1 ) NOT NULL default 'A',
`timestamp` int( 11 ) unsigned NOT NULL default '0',
`expires` int( 11 ) unsigned NOT NULL default '0',
PRIMARY KEY ( `item_id` ) ,
KEY `type` ( `type` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;

MySQL said: Documentation
#1046 - No database selected





Can someone help me make a dev section so I can do the upgrade and see if I get into any problems. I'll keep researching the issue.



Thank you,



D.

If you are doing it all via cPanel you need to rename the database file to the name of the new database.

Thanks a lot, I had not set a database first but once I did I was able to upload a new database. Now my problem is I'm not sure what I need to change in the config.php and config.local.php. I tried a whole lot of different combination but nothing is working. I only see “error occured” on the page when trying to open the dev site. In the config.local I renamed the database to the new name.



Are there any other files I should change?



Thanks for your help.



D.

[quote name='Belzibot' timestamp='1315639007' post='121385']

Thanks a lot, I had not set a database first but once I did I was able to upload a new database. Now my problem is I'm not sure what I need to change in the config.php and config.local.php. I tried a whole lot of different combination but nothing is working. I only see “error occured” on the page when trying to open the dev site. In the config.local I renamed the database to the new name.



Are there any other files I should change?



Thanks for your help.



D.

[/quote]





You will have to change the config.local.php and update the database name, username and pw. You will also have to update the locations for http and https (if applicable). Secondly you will have to update your .htaccess file if you are using SEO addon and put the correct path if this has changed.



Also, If you have ssl installed on the domain you copied you will need to go into the database of the subdomain and turn it off if you don't have a certificate installed on the subdomain.

Thanks for your help. I still can't make it work.



I've done the changes you mention but still getting error occured when loading the site.



I'm pretty sure the problem is with the database so here is what I did.


  1. I Export the original database as an SQL file from phpmyadmin.


  2. I went to my mysql and created a new database, user and associated the 2 together.


  3. I opened the new database in phpmyadmin and import the original database which worked fine.



    Now some how both databases have different sizes when looking it up in mysql.



    Now I have 2 databases.



    I created a sub domain call dev.domain.com. I uploaded all files to the dev folder.



    I opened local.config and updated the new database, user and password. In the http / https section I added the dev. in front of the domains.



    I opened .htaccess and changed this section:



RewriteCond %{HTTP_HOST} ^dev.domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.dev.domain.com$
RewriteRule ^/?$ "http\:\/\/www\dev.domain\.com" [R=301,L]




Can you see where I'm making a mistake?



Thanks again for your help.



D

Would super appreciate any help. I've tried another billion combination and still not working for me. I'm 100% sure it something to do with the way I uploaded the database.



Thanks,



D.

This is how I set up a dev site:



1.) Create a sub domain called dev.domain.com

2.) Create a new database in the MySQL wizard and assign a user

3.) Go to phpMyadmin and export my original database

4.) In phpMyadmin I go to my new database and import my original database

5.) With the file manager in the cPanel, I copy my site over to the dev folder (Just press control when dragging the files. Way faster than ftp)

6.) I modify my config.local.php to match my new database settings.

7.) I also change:


// Host and directory where software is installed on no-secure server
$config['http_host'] = 'www.domain.com';
$config['http_path'] = '';

// Host and directory where software is installed on secure server
$config['https_host'] = 'www.domain.com';
$config['https_path'] = '';




To:


// Host and directory where software is installed on no-secure server
$config['http_host'] = 'dev.domain.com';
$config['http_path'] = '';

// Host and directory where software is installed on secure server
$config['https_host'] = 'dev.domain.com';
$config['https_path'] = '';




That is it, that is all you have to do.



There is no need to change the .htaccess file since it is a subdomain.



I hope that helps.



Brandon

Thanks a lot for your help. I'll try all the steps again tomorrow.



Thank you,

D.