I have issues with my PHP installation under Ubuntu 16.04 LTS. I am getting the error: the driver is not found 1. I already tried the fix from the following post: PDOException “could not find driver” but it doesn't work. I am running Apache2 with a PHP7.2 Installation. If I run phpinfo()
I can see, that it's
"PHP Version 7.2.7-1+ubuntu16.04.1+deb.sury.org+1"
and I can see the PDO extension and the pdo_mysql extension, so theoretically it should find the driver. Both states enabled.
The Script im calling:
<?php
include("sqlconnection.php");
$statement = $pdo->prepare("SELECT * FROM reaktor WHERE reactorID = 1");
$result = $statement->execute();
$return = $statement->fetchAll();
echo json_encode($return);
?>
The sqlconnection.php:
<?php
$serverName = "nw-system.de";
$dbName = "openComputers";
$username = "";
$passwort = "";
try{
$pdo = new PDO("sqlsrv:server=$serverName ; Database=$dbName", $username, $passwort);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(Exception $e)
{
exit(print_r($e->getMessage()));
}
?>
I have deleted the username and password on purpouse
Any Ideas on how to fix this?
Kind regards
Jan