未捕获异常‘PDOException’,消息为‘无法找到驱动程序’

未捕获异常‘PDOException’,消息为‘无法找到驱动程序’

我已经在浏览器中启动了我的 Symfony 项目,但是在 error.log 中出现了这个问题

[:error] [pid 4789] [client ::1:39684] PHP Fatal error: Uncaught exception 
'PDOException' with message 'could not find driver' in /var/www/html/ensoSteps/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43\nStack trace:\n#0 /var/www/html/ensoSteps/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('sqlite:/var/www...', NULL, NULL, Array)\n#1 /var/www/html/ensoSteps/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php(60): Doctrine\DBAL\Driver\PDOConnection->__construct('sqlite:/var/www...', NULL, NULL, Array)\n#2 
/var/www/html/ensoSteps/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360):Doctrine\DBAL\Driver\PDOSqlite\Driver->connect(Array, NULL, NULL, Array)\n#3 /var/www/html/ensoSteps/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1365): Doctrine\DBAL\Connection->connect()\n#4 
/var/www/html/ensoSteps/vendor/jackalope/jackalope-doctrine-dbal/src/Jackalope/Transport/DoctrineDBAL/Client.php(2619): Doctrine\DBAL\Connection->getWrappedConnection()\n#5 
/var/www/html/ensoSteps/vendor/jackalope/jack in 
/var/www/html/ensoSteps/vendor/jackalope/jackalope-doctrine-dbal/src/Jackalope/Transport/DoctrineDBAL/Client.php on line 460

请帮助我解决这个问题。

答案1

我从未使用过 Symfony,但看起来您缺少 PDO(PHP 数据库对象)扩展的 SQLite 驱动程序。

这是由php5-sqlite包提供的,可以通过运行以下命令安装:

sudo apt-get install php5-sqlite

相关内容