I'm using Ubuntu 20.04 with PHP 7.4.3.
I have this PHP script to connect to Microsoft SQL Server 2005
<?php
function pdoOnLine() {
global $pdo;
$pdo = new PDO('dblib:host=10.10.10.10:1433;dbname=test', 'test', 'test', [
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
]);
}
try {
pdoOnLine();
} catch (\PDOException $e) {
throw new \PDOException($e->getMessage(), (int)$e->getCode());
}
?>
and I get the error
Fatal error: Uncaught PDOException: SQLSTATE[01002] Adaptive Server connection failed (10.10.10.10:1433) (severity 9)
How can I solve this problem?