未找到Symfony Class'PDO'

时间:2016-08-19 10:09:18

标签: php symfony pdo

我刚刚在一台在线服务器上传了我的symfony项目,但它给了我这个错误:

Error picture

首先我认为我应该安装pdo_mysql扩展的问题,但我发现它已经安装在服务器上了:

See this picture

我该怎么办?

编辑:

public static function getConnection(
            array $params,
            Configuration $config = null,
            EventManager $eventManager = null)
    {
        // create default config and event manager, if not set
        if ( ! $config) {
            $config = new Configuration();
        }
        if ( ! $eventManager) {
            $eventManager = new EventManager();
        }

        $params = self::parseDatabaseUrl($params);

        // check for existing pdo object
        if (isset($params['pdo']) && ! $params['pdo'] instanceof \PDO) {
            throw DBALException::invalidPdoInstance();
        } elseif (isset($params['pdo'])) {
            $params['pdo']->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
            $params['driver'] = 'pdo_' . $params['pdo']->getAttribute(\PDO::ATTR_DRIVER_NAME);
        } else {
            self::_checkParams($params);
        }
        if (isset($params['driverClass'])) {
            $className = $params['driverClass'];
        } else {
            $className = self::$_driverMap[$params['driver']];
        }

        $driver = new $className();

        $wrapperClass = 'Doctrine\DBAL\Connection';
        if (isset($params['wrapperClass'])) {
            if (is_subclass_of($params['wrapperClass'], $wrapperClass)) {
               $wrapperClass = $params['wrapperClass'];
            } else {
                throw DBALException::invalidWrapperClass($params['wrapperClass']);
            }
        }
//line 173
        return new $wrapperClass($params, $driver, $config, $eventManager);
    }

提前致谢。

1 个答案:

答案 0 :(得分:0)

您可以使用此功能显示您的服务器配置以检查是否启用了PDO扩展:http://php.net/manual/en/function.phpinfo.php