在 Apache2 PHP 7.4 上的 PDODb 上找不到驱动程序
P粉470645222
P粉470645222 2023-09-15 14:55:04
0
1
442

我使用 Ubuntu 22.04 和 php 7.4。我尝试使用 apache2 为我的网站提供虚拟主机。可以打开登录页面,在我们插入帐户后,错误显示 could not find driver on /var/www/website/app/models/PDODb.php on line229 that line is

$this->pdo = new PDO($connectionString, $this->connectionParams['username'], $this->connectionParams['password'], $options);

我已经取消注释了 php.ini 上的 extension=pdo_mysql 并且已经重新启动了 apache2。 使用 php -i | grep pdo_mysql会导致这个

/etc/php/7.4/cli/conf.d/20-pdo_mysql.ini,
API Extensions => mysqli,pdo_mysql
pdo_mysql
pdo_mysql.default_socket => /var/run/mysqld/mysqld.sock => /var/run/mysqld/mysqld.sock

这是我的 website.conf

<VirtualHost *:80>

        ServerName localhost

        ServerAlias localhost
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/website
        DirectoryIndex /index.php index.php /index.html index.html
        <Directory "/var/www/website">
        AllowOverride All
        Require all granted
    </Directory>
   RewriteEngine on     
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

这是我用于连接数据库的 config.php 定义(“DB_HOST”,“127.0.0.1”);

define("DB_USERNAME", "root");
define("DB_PASSWORD", "root123");
define("DB_NAME", "db_website");
define("DB_TYPE", "mysqli");
define("DB_PORT", "");
define("DB_CHARSET", "utf8");

我已经尝试遵循这个问题,但它仍然给我相同的结果。我该怎么办?

P粉470645222
P粉470645222

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!