1
votes

I'm using Apache/2.2.8 (Win32) PHP/5.2.6 on Windows Server 2016.

I have 2 SQL Server Instances:
1. 10.201.74.50
    - Installed on the local Windows Server above.
    - @@VERSION: Microsoft SQL Server 2016 (SP2-GDR) (KB4293802) - 13.0.5081.1 (X64) Jul 20 2018 22:12:40 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows Server 2016 Standard 10.0 (Build 14393: ) (Hypervisor)
2. 10.3.3.192\SQLEXPRESS,1433
    - Installed on another Windows Server.
    - @@VERSION = Microsoft SQL Server 2005 - 9.00.5000.00 (Intel X86) Dec 10 2010 10:56:29 Copyright (c) 1988-2005 Microsoft Corporation Express Edition with Advanced Services on Windows NT 6.1 (Build 7601: Service Pack 1)

I can connect to the 2 SQL Server Instances by Microsoft SQL Server Management Studio and Command Prompt as picture below. Microsoft SQL Server Management Studio Command Prompt

In case of PHP code, I can connect to the first server, but can't for the second:

$link = mssql_connect("10.201.74.50","hoteldw","password");
// mssql_get_last_message(): Changed database context to 'HotelDW'.
// Work

$link = mssql_connect("10.3.3.192\SQLEXPRESS,1433","p","password");
// mssql_get_last_message():
// string(73) "mssql_connect(): Unable to connect to server:  10.3.3.192\SQLEXPRESS,1433"

$link = mssql_connect("10.3.3.192\SQLEXPRESS","p","password"); 
// mssql_get_last_message():
// string(68) "mssql_connect(): Unable to connect to server:  10.3.3.192\SQLEXPRESS"

$link = mssql_connect("10.3.3.192,1433","p","password");
// mssql_get_last_message():
// string(62) "mssql_connect(): Unable to connect to server:  10.3.3.192,1433"
1
remove the port no from the second connection string. You either use instance name or port no - Squirrel
What version of ntwdblib.dll is on your PC and what does mssql_get_last_message() output? - Zhorov
@Squirrel, I tried it and there are same error. Please help to review my updated code above. - akkapolk
Update your PHP!!!!! 5.2.6 is ancient and missing a LOT of extremely critical additions - Martin
OMG - you are still using sql server 2005! Do security and support matter at all? - SMor

1 Answers

0
votes

Replace the ntwdblib.dll file on php install folder from 7.00.839 to 8.00.2039 or higher version.