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 showscould 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 uncommentedextension=pdo_mysql
on php.ini and have restarted apache2. Using php -i | grep pdo_mysqlwill 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
ServerName localhost ServerAlias localhost ServerAdmin webmaster@localhost DocumentRoot /var/www/website DirectoryIndex /index.php index.php /index.html index.html AllowOverride All Require all granted RewriteEngine on ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
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?
Just change
define("DB_TYPE", "mysqli");
todefine("DB_TYPE", "mysql");
because I only got mysql_pdo