I configured my localhost (WAMP) and now I can connect to another MS SQL server using this code.
<?php
$serverName = "<my ip>,14143\SQLEXPRESS";
$connectionInfo = array(
'Database' => 'dbname',
'UID' => 'user',
'PWD' => 'pass');
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if($conn){
echo "Database connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r(sqlsrv_errors(), true));
}
Now I want to go to shared server, but I get this error
http://akasergej-001-site1.btempurl.com/mssql.php
Array ( [0] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 10013 [code] => 10013 [2] => [Microsoft][ODBC Driver 11 for SQL Server]TCP Provider: An attempt was made to access a socket in a way forbidden by its access permissions. [message] => [Microsoft][ODBC Driver 11 for SQL Server]TCP Provider: An attempt was made to access a socket in a way forbidden by its access permissions. ) [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] => 10013 [code] => 10013 [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. ) )
Another question. Is it possible to connect to MS SQL server from linux hosting? Or i strictly need windows server for this?