PHP version is 5.3.22 non-thread safe
Database SQL Server R2, not on the same server, LAN
IIS6.0 Win2003
According to the Baidu installed
Microsoft SQL Server R2 Native Client (Sqlnlci.msi)
SQL Server Driver for PHP 2.0 Php_pdo_sqlsrv_53_nts_vc6.dll
and Php_sqlsrv_53_nts_vc6.dll
Finally php.info extension to add, but connection database time and error, I was a novice, got a few days, really no way, please help me
This is Phpinfo Riga.
The connection code is as follows
$uid = "sa";
$PWD = "1234";
$db _name= "Test";
$serverName = "155.46.2.23";
$connectionInfo =array ("UID" and "$uid" and "PWD" = $pwd, "Database" = $db _name);
$conn = Sqlsrv_connect ($serverName, $connectionInfo);
if ($conn ==false)
{
echo "Could not connect.";
Die (Print_r (Sqlsrv_errors (), true));
}else{
echo "SQL Server connect.";
}
Error
Database remote also allowed TCP/IP pipelines are enabled 1433
Save me, great gods!
Reply to discussion (solution)
Because it's not on the same server.
SQL Server to open the remote Access service and authorize
is SQL Server remote access allowed and authorization refers to the account that is authorized to log in?
is SQL Server remote access allowed and authorization refers to the account that is authorized to log in?
You follow the manager's instructions
I checked, database remote connection is allowed, with this
Http://wenku.baidu.com/link?url=W9y3IxRCMEfw_q_EJHESqVp2t8AmgBmjbu1_ Rlhrfbh9sglw8m-ehqfwcz8rk3hzqnlubpusxuqu7tnhzogxoiy4gk9mukihozc1ocnirr_
Configuration is the same
The instance name is not connected with the number of IP addresses the name of the library username and password? How do I specify the instance name?
I have some doubts whether the SQLNLCI version of the problem or my part of the configuration error, please help me to see
Sqlsrv_connect (String $serverName [, array $connectionInfo])
Parameters
$serverName: A string that specifies the name of the server to which you want to connect. This string can contain the instance name (for example, "Myserver\instancename") or the port name (for example, "MyServer, 1521"). For a complete description of the options available for this parameter, see "Server Keywor in using Connection string Keywords with SQL Native client (using the connection string keyword for SQL Native Client)" The D in the ODBC Driver Connection string Keywords (the server keyword in the ODBC driver Connection string keyword) section.
$connectionInfo [optional]: An associative array that contains the connection properties (for example, array ("Database" = "AdventureWorks")). The following table describes the keys supported by the array:
The connection code is as follows
$uid = "sa";
$PWD = "1234";
$db _name= "Test";
$serverName = "155.46.2.23";
$connectionInfo =array ("UID" and "$uid" and "PWD" = $pwd, "Database" = $db _name);
$conn = Sqlsrv_connect ($serverName, $connectionInfo);
Also I tried $serverName = "155.46.2.23\ instance name";
$serverName = "155.46.2.23,1433";
$serverName = "155.46.2.23\sqlexpress,1433";
Added port number to TCP provider error
Add Port number Try it
I used to use the machine name (with IP is not connected)
Add port number after the error has become this
I think it is the SQL Server network configuration is a problem, but the internet said the remote connection is equipped with AH
Does this thing have any effect?
You first try to test the client can not connect to the database, first confirm the parameters and network configuration is not a problem.
Landlord you can see if the local server security policy does not open port outbound inbound rules, and whether the other server is open port
Thank you for your reply, the problem solved, LAN network administrator to my database server access restrictions, he opened after I can connect, everywhere is the pit ah ...