首页 > 解决方案 > PHP Symfony 服务器 - “驱动程序发生异常:找不到驱动程序”

问题描述

我使用终端命令symfony serve(我也尝试过symfony server:start)启动名为“test2”的 Symfony 应用程序,但出现错误:

处理异常时抛出异常(Doctrine\DBAL\Exception\DriverException: An exception occurred in driver: could not find driver at /var/www/html/test2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver .php 第 102 行)

我正在使用 Ubuntu 20.04、PHP 7.4、Symfony CLI 4.25,如果需要,还可以使用 Composer 2.0

我也在使用 PostgreSQL,我跑了sudo apt-get install php-pgsql.

我也检查了“php.ini”,这是一个截图: 在此处输入图像描述

这是突出显示错误的整个响应:

[Web Server ] May 31 09:01:32 |DEBUG  | PHP    Using PHP version 7.4.18 (from default version in $PATH)
[Application] May 30 23:09:16 |CRITICA| REQUES Exception thrown when handling an exception (Doctrine\DBAL\Exception\DriverException: An exception occurred in driver: could not find driver at /var/www/html/test2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 102)
[Application] May 30 23:09:16 |CRITICA| PHP    Uncaught Exception: An exception occurred in driver: could not find driver
[Application] May 30 23:16:58 |INFO   | REQUES Matched route "index". method="GET" request_uri="https://localhost:8000/" route="index" route_parameters={"_controller":"App\\Controller\\TestController::index","_route":"index"}
[Application] May 30 23:16:58 |INFO   | SECURI Populated the TokenStorage with an anonymous Token.
[Application] May 30 23:16:58 |CRITICA| REQUES Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occurred in driver: could not find driver" at /var/www/html/test2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 102
[Application] May 30 23:16:58 |CRITICA| REQUES Exception thrown when handling an exception (Doctrine\DBAL\Exception\DriverException: An exception occurred in driver: could not find driver at /var/www/html/test2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 102)
[Application] May 30 23:16:58 |CRITICA| PHP    Uncaught Exception: An exception occurred in driver: could not find driver
[Application] May 30 23:16:58 |CRITICA| REQUES Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occurred in driver: could not find driver" at /var/www/html/test2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 102
[Application] May 30 23:16:58 |CRITICA| REQUES Exception thrown when handling an exception (Doctrine\DBAL\Exception\DriverException: An exception occurred in driver: could not find driver at /var/www/html/test2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 102)
[Application] May 30 23:16:58 |CRITICA| PHP    Uncaught Exception: An exception occurred in driver: could not find driver
[Web Server ] May 31 09:01:32 |INFO   | PHP    listening path="/usr/sbin/php-fpm7.4" php="7.4.18" port=45197
[PHP-FPM    ] May 31 09:01:32 |NOTICE | FPM    fpm is running, pid 391
[PHP-FPM    ] May 31 09:01:32 |NOTICE | FPM    ready to handle connections
[PHP-FPM    ] May 31 09:01:32 |NOTICE | FPM    systemd monitor interval set to 10000ms

有人有想法吗?

在此先感谢任何帮助者:)

标签: phppostgresqlsymfonydriver

解决方案


您可能需要从该行中删除分号,然后重新启动您的网络服务器。

通常像sudo service httpd restart.


推荐阅读