PHP Fatal error: Call to undefined function sqlsrv_connect() on heroku

131 Views Asked by At

I'm trying to connect a PHP app hosted on Heroku to a Microsoft SQL Server database located elsewhere. I've written out the connection code but everytime I push it to Heroku, Heroku just returns with PHP Fatal error: Call to undefined function sqlsrv_connect() in /app/connection.php on line 5. Can anyone help me out?

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));
}

?>

Thanks!

0

There are 0 best solutions below