Dadss Posted June 18, 2008 Share Posted June 18, 2008 Ok, before I ask, I have browsed the forums, and see really only 2 options for a critical error, can't connect to database. 1-is config.php is wrong, the other is the MySQL database. I haven't changed the config.php since it was installed. It was working fine. Was out for a month or so, and now I can't connect. The MySQL seems fine. The config.php looks the same as when it was installed. So my question is what else would cause it to not connect, and is there another option to fix it besides reinstalling? Thanks fellas. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted June 18, 2008 Share Posted June 18, 2008 Can you show the actual error, please? It could be mySQL is down or a number of other things. 0 Quote Link to comment Share on other sites More sharing options...
Dadss Posted June 18, 2008 Author Share Posted June 18, 2008 here is a screenshot. don't know if this is what you meant? http://i163.photobucket.com/albums/t290/jdunn461/ss-1.jpg 0 Quote Link to comment Share on other sites More sharing options...
bear Posted June 18, 2008 Share Posted June 18, 2008 That won't help, I'm afraid. Do you have anything else that might use mySQL to check if it's running? 0 Quote Link to comment Share on other sites More sharing options...
Dadss Posted June 18, 2008 Author Share Posted June 18, 2008 Don't think so, but I went to my Cpanel, and i run the MySQL check database for whmcs, and everything says ok? http://i163.photobucket.com/albums/t290/jdunn461/ss1.jpg 0 Quote Link to comment Share on other sites More sharing options...
bear Posted June 18, 2008 Share Posted June 18, 2008 Then the only thing that comes to mind is the config file, or the DB password was changed somehow. Without direct access it's guessing, so maybe you should open a ticket with WHMCS to have a look. 0 Quote Link to comment Share on other sites More sharing options...
automatedreferral Posted March 26, 2009 Share Posted March 26, 2009 Please someone help? I'm getting this same error critical error, can't connect to database and hoping to find a solution soon. I moved to Liquid Web hosting over 4 weeks ago and I've been having this problem every since the move. My whmcs ran fine for 6 months on the old host. In this time whmcs has looked over my site and sent me to the host to ask them, then the host looks things over and sends me back to whmcs. This has been going round and round and getting nowhere while I lose sales for weeks now. Sometimes the firefox browser will connect fine and most times in both the order side and in the admin and other times like now it does not. Customers call me and say they cant order or login because of the Critcal Error: could not connect to database. Internet explorer seems to connect most of the time when testing an order but then tickets never show up in IE no matter what I click on, they only show in Firefox and everything functions fine in firefox, when it does connect. I've reuploaded the files many times and checked configuration many times. My hosting support has checked thoroughly many times and has found no downtime in mysql or nothing in error logs. WHMCS has checked and sent me to the host on a few occasions. The host has just sent me back here now. Is there a list of settings I can give my host for a Linux VPS maybe? They have increased many settings already with no luck. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted March 26, 2009 Share Posted March 26, 2009 If you just upgraded to 3.8.2 try re-uploading dbconnect.php if that still fails upload dbconnect.php from 3.8.1 and open a support ticket. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted March 26, 2009 Share Posted March 26, 2009 Sometimes the firefox browser will connect fine and most times in both the order side and in the admin and other times like now it does not. That sounds more like mysql is overloaded and refusing connections, as a bad config file would never connect. This can be from too many users, settings that don't allow enough connections or a myriad of other things. Do you have access to post the my.cnf file for mysql to show how many connections are being allowed? 0 Quote Link to comment Share on other sites More sharing options...
automatedreferral Posted March 27, 2009 Share Posted March 27, 2009 Thank you for the helpful response. Here is my current my.cnf file. I do find that max_user_connections = 0 to be a little odd. FYI I do have many sites with lead capture pages connecting to a different database other then whmcs on my server to store web form results in. I don't know if this is also affecting things. Please tell me the best configuration for my.cnf. Thank you. root@host [~]# cat /etc/my.cnf [mysqld] max_connections = 250 max_user_connections = 0 safe-show-database skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M wait_timeout = 30 query_cache_size=64M table_cache=1024 old-passwords = 1 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash [isamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [myisamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M 0 Quote Link to comment Share on other sites More sharing options...
bear Posted March 27, 2009 Share Posted March 27, 2009 I do find that max_user_connections = 0 to be a little odd. Actually, in this case 0 means unlimited, so that's probably not it. 0 Quote Link to comment Share on other sites More sharing options...
automatedreferral Posted March 27, 2009 Share Posted March 27, 2009 Ok thanks....still searching for a solution 0 Quote Link to comment Share on other sites More sharing options...
automatedreferral Posted March 27, 2009 Share Posted March 27, 2009 Ok, I have finally narrowed down where the problem lies but I need your help to know where to go to fix it? The Critical Error: Could not connect to database only occurs with me and all of my customers when there is a www. in the address anywhere in my support folder that my whmcs is installed under it does not occur when there is no wwww. in the address in this folder area. Is this a WHMCS issue or a server issue? Thanks very much. 0 Quote Link to comment Share on other sites More sharing options...
BlogsAbout Posted March 27, 2009 Share Posted March 27, 2009 i have never heard of a www stopping a database call unless it is being treated differently by the vhost setup or dns. e.g. cant find the file. what do your access/error logs look like? You could also increase your max_connections setting to 300 and see if it clears it up. 0 Quote Link to comment Share on other sites More sharing options...
automatedreferral Posted March 28, 2009 Share Posted March 28, 2009 error logs don't show anything really. Further testing is showing that when I arrive at the error page and refresh/reload the page it does not help me to get me past the error. I then check my cookies listed for my domain in the Firefox browser. It shows several cookies including 2 PHPSESSID cookies. One is for http://www.mydomainname.com (my actual domain name) and one for mydomainname.com without the www. Both say expire at end of session. When I delete the PHPSESSID cookie corresponding to http://www.mydomainname.com because I am on a cart page that includes www. in the address bar, then refresh/ reload the error page. The error goes away and the cart page shows the way it should and I can continue through the order. What tjis actually means or how to fix it. I don't know yet? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted March 28, 2009 Share Posted March 28, 2009 One is for http://www.mydomainname.com (my actual domain name) and one for mydomainname.com without the www. Both say expire at end of session. When I delete the PHPSESSID cookie corresponding to http://www.mydomainname.com because I am on a cart page that includes www. in the address bar, then refresh/ reload the error page. This doesn't sound right. If www is the correct URI, why are you deleting that cookie? Perhaps you could force visitors to "www" using mod rewrite (if supported on your server) and that would resolve this. Create or edit your .htaccess file in the hosting account root (or just the WHMCS doc root) using the following. The first example below would force www, the second would force it to not have it. Don't use them both at once, change it to your actual domain and make sure you test this. No guarantees. # non www -> www Options +FollowSymlinks RewriteEngine On RewriteCond %{http_host} ^domain.com [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] # www -> non www Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^domain\.com RewriteRule (.*) http://domain.com/$1 [R=301, L] 0 Quote Link to comment Share on other sites More sharing options...
automatedreferral Posted March 28, 2009 Share Posted March 28, 2009 Good news, Critical Error, could not connect to database error has finally been resolved. Session on my server need to be cleared and also enabled session on request startup. Thank you for all of your help. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.