I am working with an already built database on 2008 Server R2 platform, and am wanting to create an application to query said DB.
All of my experience is with local installs of MySQL, however this database is an MS SQL server 10.50.
My question is this, The SQL server is a mapped drive to the web server, I've got all proper PHP drivers and SQLsrv extensions installed and am getting proper phpinfo read outs, everything is functioning properly, but I am stumped as to how to connect to the SQL server. To clarify,
My application lives on the web server, I am wanting to connect via php to the SQL server which is mapped to the web server. I'm using windows authentication.
The connection PHP i have written so far looks like this
<?php
$serverName = "SmartCM.IMG";
$connectionInfo = array( "Database"=>"SMARTCM");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "I tried, but it didn't work out... sorry.<br /><br><br><br>";
die( print_r( sqlsrv_errors(), true));
}
?>
This is the error read out I get
Array (
[0] => Array (
[0] => 08001
[SQLSTATE] => 08001
[1] => 53
[code] => 53
[2] => [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53].
[message] => [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. )
[1] => Array (
[0] => HYT00
[SQLSTATE] => HYT00
[1] => 0
[code] => 0
[2] => [Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired
[message] => [Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired )
[2] => Array (
[0] => 08001
[SQLSTATE] => 08001
[1] => 53
[code] => 53
[2] => [Microsoft][ODBC Driver 11 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
[message] => [Microsoft][ODBC Driver 11 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. )
)