Transferred site can't connect to database

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
burlington
Power Poster
Power Poster
Posts: 444
Joined: Wed Dec 27, 2006 5:15 pm

Transferred site can't connect to database

Post by burlington »

A new site, running CMSMS 1.11.13, was transferred to it's final destination with a new hosting package. It worked fine before transfer.
The site files and the database were copied from the design site and then uploaded to the new host. So far as I can see this worked OK.
Having checked the config.php from the design site, and ensured that the database user, password etc were precise and correct, I was surprised to get the following message after I tried to view the site:

<quote>
Database Connection Failed
Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) (2002)
Function Performed: CONNECT

Fatal error: Attempt to connect to database *** on ***@localhost failed in /var/sites/p/***/public_html/lib/adodb.functions.php on line 61
</quote>

I have carried out a transfer process before with no hitch but can't work out the reason for this failure. I have checked the config.php again and it is OK. It also has permissions of 444.
Any ideas folks?
Thanks
Martin
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Transferred site can't connect to database

Post by Dr.CSS »

If you imported the DB to a new server it may not use localhost as the DB address as not all server do some use a different path/server...
burlington
Power Poster
Power Poster
Posts: 444
Joined: Wed Dec 27, 2006 5:15 pm

Re: Transferred site can't connect to database

Post by burlington »

Dr.CSS wrote:If you imported the DB to a new server it may not use localhost as the DB address as not all server do some use a different path/server...
Thank you. You are quite right; the DB address was not localhost as I thought. The hosting company has told me the correct server address.

However,I am still getting error messages but these now relate to a module, FormBuilder, which make things a bit easier to sort out, I hope!

These messages are:

Warning: require_once(/var/sites/p/xxx.co.uk/public_html/modules/FormBuilder/classes/Form.class.php) [function.require-once]: failed to open stream: No such file or directory in /var/sites/p/xxx.co.uk/public_html/modules/FormBuilder/FormBuilder.module.php on line 57

Fatal error: require_once() [function.require]: Failed opening required '/var/sites/p/xxx.co.uk/public_html/modules/FormBuilder/classes/Form.class.php' (include_path='.:/usr/local/lib/php') in /var/sites/p/xxx.co.uk/public_html/modules/FormBuilder/FormBuilder.module.php on line 57

So if I uninstall & delete the module from the 'design' version, and all references to it in the pages etc, and upload it again, hopefully things should work.

Thank you for your advice

Martin
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Transferred site can't connect to database

Post by velden »

There's a feature in CMSMS to validate your install.

Site Admin -> System Verification

Download the file on your development environment and use it to Perform Validation on the new server.

Uninstalling a module means you will loose all it's settings, templates etc.

BTW: the error messages are pretty clear. The files aren't there probably. You did clear cache, right?
burlington
Power Poster
Power Poster
Posts: 444
Joined: Wed Dec 27, 2006 5:15 pm

Re: Transferred site can't connect to database

Post by burlington »

Thank you. Yes the cache was cleared. Also, I have managed to get rid of the error messages as mentioned before. The cause was simple; the FTP transfers for some reason missed out the contents of many of the sub-folders for Formbuilder. I have now uploaded a full version and this message has disappeared.

HOWEVER, in it's place is a whole screenful of error messages like:

<quote>
Warning: include() [function.include]: Failed opening '/home/mart1399/public_html/xxx/plugins/function.sitename.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/sites/p/xxx.co.uk/public_html/tmp/templates_c/ad83cfdd496e0d74150f5e8179bf0ea1e88e3ac2.tpl_body.24.php on line 42
</quote>

The glaring issue with this one is quite obvious to me. The mart1399 is the prefix to the database on which this site was built originally. I recognise the 'mart'!! The new database, on a different server, has a different prefix. The config file uses this of course.
I thought that the mart1399 might be somewhere in the database. I have done a search through all the tables using the Search facility in MySQL but can't find it.

Any further help would be appreciated. My inclination would be to delete everything and completely re-install but I would like to have one last attempt to make it work.

Thank you

Martin
burlington
Power Poster
Power Poster
Posts: 444
Joined: Wed Dec 27, 2006 5:15 pm

Re: Transferred site can't connect to database

Post by burlington »

Having decided that the problem is intractable, at least to me, I have deleted the program and database and am starting again with a fresh CMSMS install.

Thank you all for your advice.

Martin
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Transferred site can't connect to database

Post by velden »

The cause was simple; the FTP transfers for some reason missed out the contents of many of the sub-folders for Formbuilder.
What are the odds only the FormBuilder folder was affected? You should realize that FTP in general is an unreliable protocol. If you must use it make sure to use a decent FTP client (like Filezilla, don't download it from Sourceforge btw) and force it to use binary transfer type

I'm pretty sure you did NOT clear the CMSMS cache.

Please read instructions and tips (from this topic as well as the CMSMS docs site)
burlington
Power Poster
Power Poster
Posts: 444
Joined: Wed Dec 27, 2006 5:15 pm

Re: Transferred site can't connect to database

Post by burlington »

Again, thank you Velden.

Anyway, I am now starting again with a clean install and re-build. Luckily, I have still got the 'design' site I can copy off templates/stylesheets & content off.

Martin
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: Transferred site can't connect to database

Post by paulbaker »

burlington wrote:Anyway, I am now starting again with a clean install and re-build.
Another way of transferring between hosts: If you have cpanel (or similar control facility) on old and new host: zip up entire site on old hosting, download zip, upload zip on new host, unzip, alter config. Quicker and more efficient than FTP. And quicker than starting again from clean install.
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
Locked

Return to “[locked] Installation, Setup and Upgrade”