Hi, Sorry if i posted in a wrong section. My site keep getting few times a day about [2002] errors and usually last 3-10 minutes and the site is back up and working normal again. here are the error. Here is what i have in db-config.php <?php if(count(get_included_files())==1) header("Location: http://www.xxxxx.com"); // DISPLAY ERROR SETTING FOR SITE error_reporting(E_ALL); error_reporting(E_ALL && ~E_NOTICE); $user="xxxxxxx"; $pass="xxxxx"; $dbh = new PDO('mysql:host=localhost;dbname=xxxxxxx', $user, $pass); ?> PHP:
You're a bit off base posting wise, but not too bad. That error is usually because of a socket-error - is this on a production server, or on a test/development server? What type of server is it on? (Windows, Linux, what type of Linux, OSX?). There are plenty of information about this on Google, here is a couple of links: https://www.drupal.org/node/2110549 http://stackoverflow.com/questions/...-sqlstatehy000-2002-no-such-file-or-directory The information in the first link is based on Drupal, but can be used for other setups as well
Thanks for replied, Site is currently live and I don't know anything about coding any help are very appreciate Site is currently using 1and1 dedicated server XL 12i Managed by 1and1. Here are server detail: Current use: - MySQL5.5 - php 5.4 When error occur. I try to connect to phpmyamdin i got the following message
So? If the server is managed by 1and1, tell them about the problem, and have them fix it. It has to do with the server not being connectable, or timing out, or something else. Look at the server-logs, it should say something about why this happens, if it normally works fine. It might have to do with server load, queries stressing the database, bad config of either the server as a whole, SQL, the code you're running on the server, etc. etc. There are hundreds of possible reasons for this to happen, and it's impossible to pinpoint exactly what is happening based on what you're telling us. The error message is quite clear, and is telling you exactly what is happening, however it doesn't tell you WHY it's happening.