0

This is my code that I am working with

//Windows Authentication
<?php
$serverName = "IE3PDT1QK88G5"; 
connectionInfo = array( "Database"=>"MIN-MAK MRO ");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
 echo "Connection established.<br />";
}else{
 echo "Connection could not be established.<br />";
 die( print_r( sqlsrv_errors(), true));
}
sqlsrv_close( $conn);  
?>
Nigel Ren
  • 56,122
  • 11
  • 43
  • 55

3 Answers3

0

Make sure you are turning on your server. Printed php code on browser can be caused by the server is down.

0

Make sure your file should be saved with.php extension instead of .html.

Zainul Abideen
  • 1,829
  • 15
  • 37
0

check the apache configuration:

  • ensure that in your httpd.conf you have the line LoadModule php5_module modules/libphp5.so or LoadModule php7_module modules/libphp7.so if you're using php7
  • check that in apache configuration there is something similar to

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>
    
  • check that starting apache you don't have error messages (some broken path or some mistype in configuration or similar)

source: http://php.net/manual/en/install.unix.apache2.php

Roberto Bisello
  • 1,235
  • 10
  • 18