0

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:

enter image description here

marcss
  • 253
  • 2
  • 14
  • 2
    looks like your php interpreter is not working correctly? – christopher_pk Jul 05 '18 at 05:43
  • Please refer this [link](https://vandewalle.me/connect-to-ms-sql-server-in-php-on-ubuntu-linux-16-04-lts/) – Sanjay Chaudhari Jul 05 '18 at 05:48
  • 2
    Possible duplicate of [PHP code is not being executed, instead code shows on the page](https://stackoverflow.com/questions/5121495/php-code-is-not-being-executed-instead-code-shows-on-the-page) –  Jul 05 '18 at 05:49

0 Answers0