Page 1 of 2

From local to live server, best practices?

Posted: Tue Jan 26, 2010 2:39 am
by roro
It's time. I have bring my OC to a stage that it is going in cruel world :), on final server. I have tar all files and untar it on server, do a backup from OC admin and also in PHPMyAdmin and than restore it via phpmyadmin. I am using OC1.4, the best open source cart on mother earth.

Tried to see if it's working but it isn't.
Error:
Warning: require_once(/shop/system/startup.php) [function.require-once]: failed to open stream: No such file or directory in /home/test/public_html/test/shop/index.php on line 12 (test is my addon domain space)

Fatal error: require_once() [function.require]: Failed opening required '/jarosshop/system/startup.php' (include_path='.:/usr/lib/php') in /home/vsesorte/public_html/jaros/jarosshop/index.php on line 12


So regarding my error and migration I am looking for a best approach and so I have a few questions:

1. is recommended to clear cache in images/cache and system/cache folder?
2. how to set path properly in config php? I changed all paths in config.php from
(example): 'P:\program files\wamp\www\shop/catalog/' to /shop/catalog/. etc... without domain name, just relative paths. O.K.? Shop is my dir name for OC.
3. Config.ini line 3 and 4, I think that I have to change:
define('HTTP_SERVER', 'http://localhost/shop/');
define('HTTP_IMAGE', 'http://localhost/shop/image/');
to absolute path 'http://www.domainname.com/shop/image/' Right?
4. Or it's better to do a fresh install on final server and restore database then (last state database from localhost)? Restore from OC admin restore or from PHPmyAdmin, does it matter or not?
5. All settings done in OC admin are stored in database? Almost sure.

That's all folks. See ya. ;D

Re: From local to live server, best practices?

Posted: Tue Jan 26, 2010 4:18 am
by i2Paq
Do a clean install on you domain, delete all your files except the ones with the settings.
Empty your database (drop tables).

Make a backup of your local database (export to an sql file) and import this on your empty database. Both is done via phpMyAdmin.
FTP all your local files to your domain, except the files with the settings.

Done.

Re: From local to live server, best practices?

Posted: Wed Mar 03, 2010 8:16 am
by jontorbs
i2Paq wrote:Do a clean install on you domain, delete all your files except the ones with the settings.
Empty your database (drop tables).

Make a backup of your local database (export to an sql file) and import this on your empty database. Both is done via phpMyAdmin.
FTP all your local files to your domain, except the files with the settings.

Done.
Having been looking into a similar error that i am getting - is it worth clarifying for us noobs what exactly is an exhaustive list of all settings (for when we are up late and have zero quantifiable brain activity!?) ???

Re: From local to live server, best practices?

Posted: Wed Mar 03, 2010 10:45 am
by rph
config.php in the root directory and admin is the big one.

Unless you've been modding I'd just copy over the contents of

/catalog/view/theme/
/image/

Re: From local to live server, best practices?

Posted: Wed Mar 03, 2010 5:17 pm
by jontorbs
In terms of proper coding mods - not really, just built up upon the standard template a bit in terms of CSS - tried a few PHP changes to the cart displayed on the right hand side in terms of individual price items but didn't like it so rolled it back.

The annoying thing is that it works perfectly on the localhost but collapses when faced with the Web host - am starting to think that even though I updated the config files, there may be a bigger issue with Windows web hosting, that might be worth a walkthrough?

Re: From local to live server, best practices?

Posted: Wed Mar 03, 2010 11:53 pm
by rph
Do a clean install on the server. If it works you know what your problem is.

Re: From local to live server, best practices?

Posted: Thu Mar 04, 2010 7:31 am
by jontorbs
Have done the clean install on the now linux as opposed to Windows server... so obviously something is wrong in the config file... any thoughts?

Mind you the clean install has thrown up something new - I can't get it to access the blummin database!!! aaargh!

Re: From local to live server, best practices?

Posted: Thu Mar 04, 2010 8:09 am
by jontorbs
OK am making progress here - now am onto:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/fhlinux007/m/moonstoneyarns.co.uk/user/htdocs/system/database/mysql.php on line 6
Error: Could not make a database connection using jtorbitt@localhost
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/fhlinux007/m/moonstoneyarns.co.uk/user/htdocs/system/database/mysql.php on line 66

Now I am pretty sure that this is due to a change in database details, but seeing as I cant get through the install process due to some password error (that is not down to a typo/keying error!) I am slowing down again, would appreciate some help!

Re: From local to live server, best practices?

Posted: Thu Mar 04, 2010 9:57 am
by rph
Your MySQL database username/password is wrong.

Re: From local to live server, best practices?

Posted: Thu Mar 04, 2010 3:19 pm
by jontorbs
That's what i thought, but seeing as i specified it in the Fasthosts interface, how can it be wrong 20 times??

I have just tried again, with a clean install and fresh database and still it doesn't work - is it possible that either fasthosts have a different password or that i need to change the host reference from localhost? i tried the database ip address as well but that just throws up the same error!

Re: From local to live server, best practices?

Posted: Thu Mar 04, 2010 4:29 pm
by i2Paq
I think your error is not related to invalid info on you part but due to something going wrong with the installationscript.

Please explain your steps on what you are trying to do.

Re: From local to live server, best practices?

Posted: Thu Mar 04, 2010 5:20 pm
by jontorbs
i2Paq wrote:I think your error is not related to invalid info on you part but due to something going wrong with the installationscript.

Please explain your steps on what you are trying to do.
Thanks for the reply. Ok here we go:

1. Converted from Fasthosts Windows to Linux hosting
2. Installed PHPMyadmin
3. Created a database using the Fasthosts web interface called moonstonetest. Database is completely empty and have verified this using PHPMyAdmin.
4. Checked via FTP that htdocs folder is empty (less phpmyadmin).
5. Uploaded clean install version of Opencart 1.4 freshly downloaded from this site to prevent any changes I have made to run it on my localhost (where it ran perfectly first time).
6.uploaded the contents of the 'upload' folder (not including the actual folder) to the htdocs folder on the web host which equates the the website root folder www.moonstoneyarns.co.uk
7. Called up the website which prompts the runonce install page, happy with the terms and conditions so clicked continue to step 2.
8. Checked that everything is as it should be but MagicQuotes GPC is set to on not off (which it needs to be but this was the same on my localhost and still worked fine).
Clicked continue to step 3.

Typed in the following:

Database Host: localhost
User: my username as specifed when creating the database using Fasthosts (if i don't do it using Fasthosts there is nothing for phpmyadmin to actually look at??)
Password: as typed in via Fasthosts for the database
Database Name: as above, typed in correctly
Database prefix: nothing typed in here, just left blank

Adminstrator details:

Username: admin
Password: a different password to the database
Email: my email address

Short of it being something to do with the phpmyadmin settings (which i thought would have had no effect whatsoever), I am a total loss!

Any help gratefully appreciated and repaid in kind with virtual mini eggs!

Re: From local to live server, best practices?

Posted: Thu Mar 04, 2010 5:40 pm
by i2Paq
So the error you get is just running a clean install.

It looks like the install script is not compatible with your MySQL (actualy, you MySQL is not set up the way OC wants it).

What you could do is make a backup of you local DB using phpMyAdmin and export your database.
Then import this database using phpMyAdmin in your empty database at your hoster.
Upload your local files via ftp to your webspace and adjust your 2 configs manually.

Re: From local to live server, best practices?

Posted: Thu Mar 04, 2010 6:36 pm
by jontorbs
i2Paq wrote:So the error you get is just running a clean install.

It looks like the install script is not compatible with your MySQL (actualy, you MySQL is not set up the way OC wants it).

What you could do is make a backup of you local DB using phpMyAdmin and export your database.
Then import this database using phpMyAdmin in your empty database at your hoster.
Upload your local files via ftp to your webspace and adjust your 2 configs manually.
That sounds like good advice but when I tried that last night the import using phpmyadmin trips up when it apparently tries to truncate the address fields....?

Could it be something related to the Fasthosts MySQL setup?? Here is the error I get from phpmyadmin:

Error
SQL query:

TRUNCATE TABLE `address` ;

MySQL said:

#1046 - No database selected

Re: From local to live server, best practices?

Posted: Thu Mar 04, 2010 7:15 pm
by i2Paq
It looks like your export is not correctly done.
How do you do your export?

How big is that export sql file?

Re: From local to live server, best practices?

Posted: Thu Mar 04, 2010 11:29 pm
by jontorbs
i2Paq wrote:It looks like your export is not correctly done.
How do you do your export?

How big is that export sql file?
I originally did a backup from the admin part of the OC shop running on localhost.

The file details are:

moonstonetest.sql (i renamed it today, wonder if that will affect it but should make no difference for importing to an empty database).
File size: 573 KB on disk (572,413 bytes)

Whilst I saved it elsewhere to prevent me deleting it, the path for creation was:
//localhost:8888/oc/admin/index.php?route=tool/backup/backup
//localhost:8888/oc/admin/index.php?route=tool/backup

I have tried to import it several times using phpmyadmin import facility, each time it comes up with the truncate error regardless of whether I select any verification or not.

Thoughts (ps i really appreciate this!)

J

Re: From local to live server, best practices?

Posted: Fri Mar 05, 2010 12:01 am
by jontorbs
It was 573k for the sql backup file form OC, but when compressed to a zip, it became 74k and now phpmyadmin says that it is in an unrecognised format as follows:

You attempted to load file with unsupported compression (application/zip). Either support for it is not implemented or disabled by your configuration.

Curiouser and curiouser!

Re: From local to live server, best practices?

Posted: Fri Mar 05, 2010 12:04 am
by jontorbs
The export was 573k, reduced to 75k once zipped, but then the blumming server refuses to recognise zip as file format not supported! Also more interesting was when i was logged into phpmyadmin, I thought, heck let's try creating a blank database in here - it appears that my admin user account (as specified in the Fasthosts front end) does not have the authority to create a database!!!

I wonder if that has something to do with it??

I sense a support ticket going in soon!

Re: From local to live server, best practices?

Posted: Fri Mar 05, 2010 12:39 am
by rph
Restore backups made through phpMyAdmin in phpMyAdmin and backups made in OpenCart through OpenCart. 573k is small enough that you don't have to worry about compressing the file.

Re: From local to live server, best practices?

Posted: Fri Mar 05, 2010 12:50 am
by i2Paq
jontorbs wrote:I sense a support ticket going in soon!
I would contact your hoster about this, they should be able to help.

Do not let them say that it is the script.