繁体   English   中英

PHP Symfony 服务器 - “驱动程序发生异常:找不到驱动程序”

[英]PHP Symfony server - "An exception occurred in driver: could not find driver"

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

处理异常时抛出异常 (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 205。

我也在使用 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

有人有想法吗?

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

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

通常类似于sudo service httpd restart

问题解决了,我删除并重新安装了 PHP 的 PostgreSQL 扩展,任何与 Symfony 相关的东西。 并永久删除未使用的 PHP 版本。 我还惊讶地在“php,ini”中留下了评论。 没必要碰它。 现在可以了。

这是解释如何删除 Symfony 的链接(使用ls -al ~/.symfony等查看第二个答案): 如何从 macCEDB45667Z 和作曲家中完全卸载 Z78D5167FF84CCBB91FD6211

要删除 PHP 的 PostgreSQL 扩展: sudo apt-get --purge remove php-pgsqlsudo apt-get purge php-pgsql

我删除了系统上未使用的 PHP 版本: sudo apt-get purge 'php5.6'

要重新安装 PHP 的 PostgreSQL 扩展,我输入了sudo apt-get install php-pgsql

为了再次获得 Symfony,我按照以下步骤操作: https://symfony.com/download (适用于 Linux)

感谢所有提供帮助的人。 我非常感谢它:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM