Erdem Çetin
Erdem Çetin

Reputation: 495

sqlsrv_connect not working with instance

I am trying to connect Mssql Server with Instance Name from PHP7 .My operating system Ubuntu 16.04 LTS. I connected different Mssql Server without Instance name on Ubuntu .I tested Mssql Server with Instance with Heidi Sql over another windows7 .It is working.

PHP Page::

$serverName = "10.10.0.1/Instance"; 
$connectionInfo = array( "Database"=>"Dbname", "UID"=>"user", "PWD"=>"pass");
$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));
}

Upvotes: 2

Views: 2046

Answers (1)

Erdem &#199;etin
Erdem &#199;etin

Reputation: 495

I solved from MSSQL server side. In SQL-Server-Configuration-Manager > SQL-Server-Network-Configuration>Protocol-Name(TCP/IP) . TCP/IP status needs to be Enabled. And open Properties > IP Addresses > IP All > TCP Port needs to be 1433.

enter image description here

Upvotes: 1

Related Questions