Avatar ·

PDOException "could not find driver" error in PHP: causes and solution on LAMP

Hello everyone! I'm a beginner in PHP and trying to set up a MySQL connection via PDO on my local server (LAMP — Linux, Apache, MySQL, PHP). I have Ubuntu, I installed all components via apt, but when I run the script, I get this error: ``` Fatal error: Uncaught PDOException: could not find driver in /var/www/html/test.php:3 ``` Here is my code: ```php getMessage(); } ?> ``` I have already checked that the MySQL server is running (via `systemctl status mysql`), the testdb database exists, and the root user without a password works in the MySQL console. But PDO