使用 PHP 从 Linux 服务器连接到远程 MS SQL 数据库

Connection to remote MS SQL database from Linux server using PHP

我在 Linux 服务器上托管了我的网站,我想连接 MS SQL 数据库。我在编程中使用了 PHP。我已经联系了这两个服务器提供商,他们在一定程度上提供了帮助。但是我的问题没有解决,你能指导我该怎么做吗?我的代码如下。

虽然我 运行 它显示“找不到驱动程序 1”

请指导我。提前致谢

<?php 

//echo phpinfo();

?>
<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <h1>testing</h1>
</body>
</html>

<?php
// Server in the this format: <computer>\<instance name> or 
// <server>,<port> when using a non default port number
$server = 'server:port';
$myDB = "DatabaseName";

// Connect to MSSQL
$link = mssql_connect($server, 'username', 'password');

if (!$link) {
    die('Something went wrong while connecting to MSSQL');
}
else
{
 echo "success";
}
?>
<?php

try {

    $conn = new PDO("sqlsrv:Server='server_name';Database=database_name", 'username', 'password');
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

} catch (Exception $e) {

    die(print_r($e->getMessage() ));
}

$tsql = "select * from table_name";
$getResults = $conn->prepare($tsql);
$getResults->execute();
$results = $getResults->fetchAll(PDO::FETCH_BOTH);

foreach ($results as $row) {
  echo $row['0'].' '.$row['6'];
  echo "<br>";
}


?>