Relocating a C5 site

Permalink
I'm moving to a new host and trying to get one of my C5 sites working from the new location.

I'm getting this error message...

[Unable to connect to database.

A database error occurred while processing this request.

Catchable fatal error: Argument 1 passed to ConfigStore::__construct() must be an instance of Database, null given, called in /home/pranzare/public_html/CoCoMR/concrete/models/config.php on line 48 and defined in /home/pranzare/public_html/CoCoMR/concrete/models/config.php on line 136]

I updated the site.php file with the new location of the database and other parameters. Is this a sign the database is not working, or something else?
gewald
View Replies:
kdyer replied on at Permalink Reply
kdyer
Here is what we have in site.php for one of my sites:
<?php 
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'db_user');
define('DB_PASSWORD', 'db_password');
define('DB_DATABASE', 'concrete');
define('BASE_URL', 'http://www.your_site.com');
define('DIR_REL', '');
define('PASSWORD_SALT', 'YOUR_SALT_VALUE');


Thanks,

Kent
gewald replied on at Permalink Reply
gewald
Same as mine. This error message is confounding. Bad enough that you get invested in one CMS that migrating isn't easy, but changing servers needs to be easier.
fastcrash replied on at Permalink Reply
fastcrash
are you sure the DB_SERVER is 'localhost'?
i experience this error before, it c'uz the DB_SERVER not localhost
gewald replied on at Permalink Reply
gewald
Should have been more clear. I have all those items, but with values relevant to my installation.
Vivid replied on at Permalink Reply
Vivid
I have no issues moving servers. It kind of just seems like you've missed something simple. Wrong name/password, didn't create the database you though you did etc...
3198garry replied on at Permalink Reply
check the root name of the database is correct, for example it may look like

define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'user_databasename');

especially so in cpanel

hope this helps

Garry
hcelada replied on at Permalink Reply
When relocating a C5 site from one host to another, do I simply copy the content and database or re-install C5 then import the database and some content

If so, which content needs to move over on a clean install?
gewald replied on at Permalink Reply
gewald
I'm in the middle of moving a dozen sites (note to self, pick my host wisely because this is a pain). I've found it easiest to install C5 from scratch, and then bring over the site.php file (but you will need to edit it for your new host) and any installed add-ons or themes. Create a new MY SQL database and import the data from your old host into it.
mesuva replied on at Permalink Reply
mesuva
I would advise you to copy a full site completely and set up the database again instead of re-installing C5 and trying to set up things how they were.

If you have access to something like cPanel that allows you to zip up folders on your website, you really can do a migration in a matter of minutes (ignoring the time it takes to upload/download).

I know there are some decent guides out there how to do this, but briefly I would suggest these steps:

On the old server
- Turn off the cache and clear it
- Download a copy of the entire site. You could possibly zip this up in one go to download using the File Manager in cPanel, much quicker than ftp-ing all the files. Make sure you include the .htaccess file.
- Export a copy (a 'dump') of your database using something like phpMyAdmin

On the new server:
- Create a new database and database user that can access the new database, import the database dump you exported.
- Upload all of the site files (if zipped up, just upload this and expand the zip in the file manager)
- Edit the /config/site.php file to reflect the new database name, user and password. Edit this also to reflect the correct base url (since it will probably be a temporary url initially)
- Test that things work, log into the new site and turn the cache back on if required

I find that the trickiest part of migrating sites isn't the site bit itself, it's managing the migration of email accounts!
gewald replied on at Permalink Reply
gewald
For some reason when I tried moving my original site's folder I had occasional problems so I did the clean install and just grabbed. Htaccess, config/site,php, and the packages directory with more success. Then I edited the site.php for the new settings and I was up and running. Now, though, I have found a couple of sites that has broken image links since they were stored somewhere else. I wont be changing hosts too often after this.