【问题标题】:Zend + Doctrine: Slow PDO connectionZend + Doctrine:慢 PDO 连接
【发布时间】:2013-06-10 20:32:44
【问题描述】:

Zend 网站的响应非常缓慢,xdebug 显示 Doctrine\DBAL\Driver\PDOConnection 类有 20.000 毫秒(20 秒)的延迟。该类的源代码如下:

    namespace Doctrine\DBAL\Driver;

use \PDO;

/**
 * PDO implementation of the Connection interface.
 * Used by all PDO-based drivers.
 *
 * @since 2.0
 */
class PDOConnection extends PDO implements Connection
{
    public function __construct($dsn, $user = null, $password = null, array $options = null)
    {
        parent::__construct($dsn, $user, $password, $options);
        $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Doctrine\DBAL\Driver\PDOStatement', array()));
        $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
}

什么可能导致 20 秒的连接时间?请务必注意,我有其他网站在同一台服务器上使用 PDO,但只有 Zend 有这个问题。

【问题讨论】:

    标签: php zend-framework pdo doctrine-orm doctrine


    【解决方案1】:

    解决了,使用 127.0.0.1 而不是 localhost 连接就可以了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-19
      • 2013-11-10
      • 2018-09-24
      • 2017-01-15
      • 2020-01-30
      • 2015-01-08
      • 1970-01-01
      相关资源
      最近更新 更多