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?
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.
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!
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.
You are allowed to delete your post for 5 minutes after it's posted.