我剛搬到我的Drupal網站到另一個域/主機Mysql的例外:SQLSTATE [HY000] [2013]
我感動的DB,現在我所有的網站。但是,當我瀏覽網頁(juniorsteps.be),我得到以下異常:
PDOException: SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in lock_may_be_available() (line 165 of /home/sites/webhosting/juniorsteps/juniorsteps/www/includes/lock.inc).
我GOOGLE了,但我仍然沒有找到一個解決方案。
希望有人能幫忙。
UPDATE
由於要求從行的代碼。這是下面的函數的第一行:
function lock_may_be_available($name) {
$lock = db_query('SELECT expire, value FROM {semaphore} WHERE name = :name', array(':name' => $name))->fetchAssoc();
if (!$lock) {
return TRUE;
}
$expire = (float) $lock['expire'];
$now = microtime(TRUE);
if ($now > $expire) {
// We check two conditions to prevent a race condition where another
// request acquired the lock and set a new expire time. We add a small
// number to $expire to avoid errors with float to string conversion.
return (bool) db_delete('semaphore')
->condition('name', $name)
->condition('value', $lock['value'])
->condition('expire', 0.0001 + $expire, '<=')
->execute();
}
return FALSE;
}
但說實話,我不認爲錯誤是在我的代碼,因爲它完美的作品我的開發服務器上。
投票決定關閉,您的問題無法以目前的形式回答,我們需要比這樣更多的細節。 '/ home/sites/webhosting/juniorsteps/juniorsteps/www/includes/lock.inc'的第165行附近的代碼將是一個很好的開始。 – Johan
我添加了代碼,但我不認爲它是代碼,因爲該網站在我的開發服務器上工作,現在我移動它,我得到了錯誤。 :■ –