我刚刚将我的drupal站点移动到另一个域/主机
我移动了数据库,现在我的所有网站.但是当我访问网站(juniorsteps.be)时,我得到以下异常:
PDOException:SQLSTATE [HY000] [2013]在'读取初始通信数据包'时失去与MySQL服务器的连接,系统错误:111在lock_may_be_available()中(/ home/sites/webhosting/juniorsteps/juniorsteps/www/includes/lock的第165行) .公司).
我用谷歌搜索了它,但我仍然没有找到解决方案.
希望有人能提供帮助.
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;
}
Run Code Online (Sandbox Code Playgroud)
但说实话,我不认为我的代码中存在错误,因为它在我的开发服务器上完美运行.
检查你的settings.php
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => '333333',
'username' => '333333',
'password' => '3333333',
'host' => '122.124.12.09', // check host -> maybe not localhost
'port' => '3304', // check port!
'driver' => 'mysql',
'prefix' => '',
),
),
);
Run Code Online (Sandbox Code Playgroud)