I have php with connect to SQL Server.
<?php
$serverName = "AC-CLOUD"; //serverName\instanceName
$connectionInfo = array( "Database"=>"DataSEAS", "UID"=>"sa", "PWD"=>"Masterkey2010", "CharacterSet" => "UTF-8");
$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));
}
?>
$sql = "SELECT sc.Id as Id, sc.Code, sc.Name, sc.Specification, sc.Specification2, sc.X_Specification3, f.Name as firma_Name FROM StoreCards sc
left join firms f on f.id = sc. X_pozicane_u ";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
When I connected it with fastcgi, it is working fine, but now I need to connect it with Apache and it isn't working with this code. When I tried another php code with Apache, or phpinfo
, it's working fine, but this connect to db with apache, doesn't work. Can you help me?