I've got an Ubuntu 16.04 Virtual Machine with Apache and PHP, i need to connect to SQL Server. I had installed the ODBC's following the Microsoft instructions.
I've deleted the index.html from /var/www/html and created index.php like this:
<?php
$serverName = "192.168.1.XXX"; //serverName\instanceName
$connectionInfo = array( "Database"=>"Datos", "UID"=>"user", "PWD"=>"XXXX");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Conexión establecida.<br />";
}else{
echo "Conexión no se pudo establecer.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
And when I use the firefox to see the web: