0

what would cause this error, it seems that database can be connected but i cannot do it with the below code to this specific database on this server but i can connect to some other host database with below code, can you please help? Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) some part of first config file

<?php
/**
 * 
 */
$sys_lang = "tr";
 $config = array();
//include("lang_en.php");
//Veritabani degiskenleri.
date_default_timezone_set("Europe/***");
$ini_kur = 1;
if (isset($_GET["lang"]))
	{
		//if ($_GET["lang"] == "tr" || $_GET["lang"] == "en")
		if ($_GET["lang"] == "tr" || $_GET["lang"] == "en")
			{
				setcookie("lang", "");
				setcookie("lang", $_GET["lang"], time()+1296000);
			}
		else
			{
				setcookie("lang", "");
				setcookie("lang", "tr", time()+1296000);
			}
		header("Location: ".$_SERVER['PHP_SELF']);
		die();
	}
$sys_lang = (isset($_COOKIE["lang"])) ? $_COOKIE["lang"] : "tr"; 				 
$sys_lang = "tr";		

if (!function_exists('secureVars')) {
function secureVars($string) { 
	$string = strip_tags($string); 
	$string = htmlspecialchars($string); 
	$string = trim($string); 
	$string = stripslashes($string); 
	//$string = mysql_real_escape_string($string); 
return $string; 
}
}


foreach ($_POST as $k=>$v) { 
    $_POST[$k] = secureVars($v); 
} 
 
foreach ($_GET as $k=>$v) { 
    $_GET[$k] = secureVars($v); 
}

$dbH = "xxx.xx.x.xxx";
$dbU = "mydatabaseuser";
$dbP = "mypassword";
$dbD = "mydatabase";
//Session
$config["session_save_path"] = "";

// 
//$config["pwd_date"] = "2010-04-12";
// 
//
$config["log_dir"] = "-";
...............................................

second config file

<?php
ob_start();
/*
$dbH = "localhost";
$dbU = "root";
$dbP = "root";
$dbD = "live";
*/

$dbH = "xxx.xx.x.xxx";
$dbU = "mydatabaseuser";
$dbP = "mypassword";
$dbD = "mydatabse";


$site = array();
$site["email"] = "-.com";
$site["name"] = "-";
$site["title"] = "-";
$site["URL"] = "-.com"; // 
$site["mailHost"] = "-";
$site["mailUser"] = "-";
$site["mailPass"] = "-";
?>
2
Contributors
3
Replies
5
Views
5 Years
Discussion Span
Last Post by diafol
0

why do you have multiple connects? How do these two files work together?

The second file has ob_start() - what are you doing with it?

It may be that you have too many open connections to the DB. Try limiting open connections to just one and clear the cache. See if it helps.

0

hi,
what do you mean too many open connection to the database. what can i do or how can i chance and fix it?

when it points to the database in the dedicated server that i have it gives the error but when i point it to my shared web hosting company's server it works with no problem but i need to use my dedicated server and so far no luck

I have no idea about coding and i have been searching and searching to make this work. but could not do it yet

why do you have multiple connects? How do these two files work together?

The second file has ob_start() - what are you doing with it?

It may be that you have too many open connections to the DB. Try limiting open connections to just one and clear the cache. See if it helps.

0

When you say dedicated server, are you still trying to access the db on your company's shared server? If so, this is the problem. If your hosting has cPanel, you may be able to allow remote access - but you need to configure this yourself.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.