MySQL Host, User, Password, DB 정보에 오류가 있습니다.
MySQL Host, User, Password, DB 정보에 오류가 있습니다.
오류가 나오는 이유는 비번이나 phpMyAdmin 접속이 안되어서 오류가 발생합니다..
근데 갑자기 다시되?? 그러면 저장공간이 100%이상차 있을경우 그리고 MySQL 접속 제한(동시접속/트래픽 폭주/봇 공격) 경우입니다... 근데 소스에는 이상이 없어 그럴때 이렇게 하시면 됩니다.. MySQL Host, User, Password, DB 정보에 오류가 있습니다. <= 이 문구 보다 다른 문구가 났겠죠?
오류가 갑자기 나타났다가 사라져도 찜찜 할경우 이렇게 대체하세요.
common.lib.php
이부분을
function sql_connect($host, $user, $pass, $db=G5_MYSQL_DB)
{
global $g5;
if(function_exists('mysqli_connect') && G5_MYSQLI_USE) {
mysqli_report(MYSQLI_REPORT_OFF);
$link = @mysqli_connect($host, $user, $pass, $db) or die('MySQL Host, User, Password, DB 정보에 오류가 있습니다.');
// 연결 오류 발생 시 스크립트 종료
if (mysqli_connect_errno()) {
die('Connect Error: '.mysqli_connect_error());
}
} else {
$link = mysql_connect($host, $user, $pass);
}
return $link;
}
1672번줄 수정본
// DB 연결
function sql_connect($host, $user, $pass, $db=G5_MYSQL_DB)
{
global $g5;
if(function_exists('mysqli_connect') && G5_MYSQLI_USE) {
mysqli_report(MYSQLI_REPORT_OFF);
// 1) or die 제거
$link = @mysqli_connect($host, $user, $pass, $db);
// 2) 연결 실패 시 503 점검 페이지 출력
if (!$link || mysqli_connect_errno()) {
header('HTTP/1.1 503 Service Unavailable');
header('Content-Type: text/html; charset=utf-8');
echo '<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>점검 중</title>
</head>
<body style="text-align:center;margin-top:100px">
<h1>접속자가 너무많아 이페이지를 띄웁니다.</h1>
<p>잠시 후 다시 접속해주세요.</p>
</body>
</html>';
exit;
}
} else {
$link = mysql_connect($host, $user, $pass);
// 구버전 mysql_connect도 실패 처리 원하면 여기도 동일하게 추가 가능
if (!$link) {
header('HTTP/1.1 503 Service Unavailable');
header('Content-Type: text/html; charset=utf-8');
echo '<h1>접속자가 너무많아 이페이지를 띄웁니다.</h1><p>잠시 후 다시 접속해주세요.</p>';
exit;
}
}
return $link;
}
// End