1

Im using Ubuntu 22.04 and php 7.4. I tried to virtual hosting with apache2 for my website. The login page can be opened and after we insert account the error shows up 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 already uncomment the extension=pdo_mysql on php.ini and already restart the apache2. Using php -i | grep pdo_mysqlwill result 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

Here's 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>

Here's my config.php for connection to 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 already tried to follow this question but it still giving me same result. What should I do?

Worst
  • 13
  • 3

1 Answers1

0

Only need to change define("DB_TYPE", "mysqli"); to this define("DB_TYPE", "mysql"); Because i only got mysql_pdo

Worst
  • 13
  • 3