What could be causing the ODBC Access issue in PHP on a Windows Server 2019 with IIS 10?

The ODBC Access issue in PHP on a Windows Server 2019 with IIS 10 could be caused by missing or incorrect ODBC drivers, incorrect connection settings, or permissions issues. To solve this problem, ensure that the correct ODBC drivers are installed, double-check connection settings in your PHP code, and verify that the necessary permissions are set for the ODBC connection.

<?php
$serverName = "your_server_name";
$databaseName = "your_database_name";
$username = "your_username";
$password = "your_password";

$conn = odbc_connect("Driver={ODBC Driver 17 for SQL Server};Server=$serverName;Database=$databaseName;", $username, $password);

if (!$conn) {
    die("Connection failed: " . odbc_errormsg());
} else {
    echo "Connected successfully!";
}

odbc_close($conn);
?>