I'm trying to connect to a local MSSQL Database via PHP (PDO) using following Code:
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
$db = new PDO("sqlsrv:Server=10.5.5.1,1433;Database=PWS", "Administrator", "password");
if(!$db)
{
echo mysqli_connect_error();
}
else
{
echo 'connected';
}
?>
I'm getting following error message: Fatal error: Uncaught PDOException: could not find driver in /var/www/html/test/index.php:5 Stack trace: #0 /var/www/html/test/index.php(5): PDO->__construct() #1 {main} thrown in /var/www/html/test/index.php on line 5
PHP is running on an Ubuntu 20.04.4 LTS with following modules installed:
libapache2-mod-php8.0
php-common
php8.0
php8.0-bz2
php8.0-cli
php8.0-common
php8.0-gd
php8.0-interbase
php8.0-mbstring
php8.0-mysql
php8.0-opcache
php8.0-readline
php8.0-xml
php8.0-zip
According to phpinfo();, pdo, pdo_mysql, pdo_firebird are enabled