我正在尝试将Heroku上托管的PHP应用程序连接到位于其他位置的Microsoft SQL Server数据库。我已经写出了连接代码,但每当我将它推送到Heroku时,Heroku只会返回PHP Fatal error: Call to undefined function sqlsrv_connect() in /app/connection.php on line 5
。任何人都可以帮助我吗?
connection.php:
<?php
$serverName = "nameOfHost.net\serverInstance, 1234";
$connectionInfo = array( "Database"=>"competition", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if($conn) {
echo "Connection established. <br />";
} else {
echo "Connection cannot be established. <br />";
die( print_r( sqlsrv_errors(), true));
}
?>
谢谢!