Driver not found on PDODb on Apache2 PHP 7.4
P粉470645222
P粉470645222 2023-09-15 14:55:04
0
1
715

I use Ubuntu 22.04 and php 7.4. I'm trying to use apache2 to provide a virtual host for my website. The login page can be opened, after we insert the account, the error shows 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);

I have uncommented extension=pdo_mysql on php.ini and have restarted apache2. Using php -i | grep pdo_mysql will result in this

/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

This is my 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>

This is the config.php I use to connect to the database define("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");

I have tried following this question but it still gives me the same result. what do I do?

P粉470645222
P粉470645222

reply all(1)
P粉308089080

Just change define("DB_TYPE", "mysqli"); to define("DB_TYPE", "mysql"); because I only got mysql_pdo

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template