473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

PHP with SQL Server

I am unable to connect to certain SQL servers from PHP on IIS.

I have two IIS 5 servers, both are Windows 2000 Server boxes with PHP
4.3.4 and MDAC 2.80.1022.3. I have three SQL Server machines - two
SQL2K SP3a machines and one SQL 7.0 SP4 machine. One of the SQL2K
servers is the same machine as one of the IIS 5 servers.

One of the IIS servers, Server1, can mssql_connect to all three SQL
servers. The other IIS server, Server2, can only mssql_connect to one
of the SQL2K servers. I get a "connect failed" error when attempting
to hit the other two SQL servers. The one it can connect to,
incidentally, is the SQL server that resides on the _other_ IIS
server.

I have tried copying the PHP application from Server1 to Server2. The
same PHP app that can connect to all three SQL Servers from Server1
can only connect to SQL on Server1 from Server2.

Here's a chart of the servers:

ServerName |OS |SQL Version |PHP Can connect to...
-------------|-----------|----------------|-------------------------
Server1 |Win2k Svr |SQL2K SP3a |Server1, Server3, Server4
Server2 |Win2k Svr |N/A |Server1
Server3 |NT 4.0 |SQL7 SP4 |N/A
Server4 |Win2k3Svr |SQL2K SP3a |N/A
Any insight would be greatly appreciated.
Jul 17 '05 #1
4 5369
Hi Jack!

Someone called Google Mike has some threads running about SQL server
here as well. You should check them out.

On 25 Nov 2003 06:42:30 -0800, jo*******@county.allegheny.pa.us (Jack
Smith) wrote:
I am unable to connect to certain SQL servers from PHP on IIS.

I have two IIS 5 servers, both are Windows 2000 Server boxes with PHP
4.3.4 and MDAC 2.80.1022.3. I have three SQL Server machines - two
SQL2K SP3a machines and one SQL 7.0 SP4 machine. One of the SQL2K
servers is the same machine as one of the IIS 5 servers.

One of the IIS servers, Server1, can mssql_connect to all three SQL
servers. The other IIS server, Server2, can only mssql_connect to one
of the SQL2K servers. I get a "connect failed" error when attempting
to hit the other two SQL servers. The one it can connect to,
incidentally, is the SQL server that resides on the _other_ IIS
server.
I would first check DNS and WINS. Open a cmd-prompt on the server
where it fails and connect to the server with telnet.

Eg. if you use "30.30.30.30:1433" try telnet 30.30.30.30 1433

ut if you use a name, try this one.

Eg. telnet sqlserver5 1433

If it connects, then its not a network problem, otherwise it is.
I have tried copying the PHP application from Server1 to Server2. The
same PHP app that can connect to all three SQL Servers from Server1
can only connect to SQL on Server1 from Server2.

Here's a chart of the servers:

ServerName |OS |SQL Version |PHP Can connect to...
-------------|-----------|----------------|-------------------------
Server1 |Win2k Svr |SQL2K SP3a |Server1, Server3, Server4
Server2 |Win2k Svr |N/A |Server1
Server3 |NT 4.0 |SQL7 SP4 |N/A
Server4 |Win2k3Svr |SQL2K SP3a |N/A
Any insight would be greatly appreciated.


HTH, Jochen
--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #2
Jack Smith wrote:

One of the IIS servers, Server1, can mssql_connect to all three SQL
servers. The other IIS server, Server2, can only mssql_connect to one
of the SQL2K servers. I get a "connect failed" error when attempting
to hit the other two SQL servers. The one it can connect to,
incidentally, is the SQL server that resides on the _other_ IIS
server.


One/some of your SQL servers may be blocking IP addresses or ranges.
The server OS may also be blocking ports. Ports may be blocked on a
host/network basis.

check your IP filters on all machines concerned.

Jul 17 '05 #3
Thanks for your replies!

I forgot to mention in my post that I know it's not a network issue
because the same webserver, Server2, has ASP apps running with Server3
as a back-end. There are no problems. It was only a connection issue
when hitting Server3 and Server4 from Server2 with PHP.

I have found the problem - it was under my nose in the PHP manual
posts all along. I read through these before but must have had my
blinders on. The problem was with the ntwdblib.dll. Server1 had an
old version 7.00.xx. Server2 had version 8.00.xx. I copied the dll
from Server2 to Server1 and all was good with the world.
http://www.php.net/manual/en/function.mssql-connect.php
[snip]
Besides my comment about the instances of SQLServer (see above), its
very important to have the latest version of NTWDBLIB.DLL. With Php
4.2.1 comes de NTWDBLIB version 7.00, with this version the conection
isn´t work! you have to install the version that comes with the client
of SQLServer 2000. Be careful, because installing the client sometimes
doesn´t replace the NTWDBLIB, then search for it in the SQLServer
Installer Disc an replace it in the system32 directory of
Windows(SQLSERver 2000 comes with Version 8.00 of NTWDBLIB.DLL).
[/snip]
Jul 17 '05 #4
Do you have SQL Server Authentication enabled on all the servers? I
don't think PHP's MSSQL module can do Windows Authetication (I could
be wrong, however).

Try setting the SQL client's connection preference to TCP/IP (over
named pipe) as well.

jo*******@county.allegheny.pa.us (Jack Smith) wrote in message news:<b4**************************@posting.google. com>...
I am unable to connect to certain SQL servers from PHP on IIS.

I have two IIS 5 servers, both are Windows 2000 Server boxes with PHP
4.3.4 and MDAC 2.80.1022.3. I have three SQL Server machines - two
SQL2K SP3a machines and one SQL 7.0 SP4 machine. One of the SQL2K
servers is the same machine as one of the IIS 5 servers.

One of the IIS servers, Server1, can mssql_connect to all three SQL
servers. The other IIS server, Server2, can only mssql_connect to one
of the SQL2K servers. I get a "connect failed" error when attempting
to hit the other two SQL servers. The one it can connect to,
incidentally, is the SQL server that resides on the _other_ IIS
server.

I have tried copying the PHP application from Server1 to Server2. The
same PHP app that can connect to all three SQL Servers from Server1
can only connect to SQL on Server1 from Server2.

Here's a chart of the servers:

ServerName |OS |SQL Version |PHP Can connect to...
-------------|-----------|----------------|-------------------------
Server1 |Win2k Svr |SQL2K SP3a |Server1, Server3, Server4
Server2 |Win2k Svr |N/A |Server1
Server3 |NT 4.0 |SQL7 SP4 |N/A
Server4 |Win2k3Svr |SQL2K SP3a |N/A
Any insight would be greatly appreciated.

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil | last post by:
I am using a Pascal like language (Wealth-Lab) on W2K and call this server: class HelloWorld: _reg_clsid_ = "{4E797C6A-5969-402F-8101-9C95453CF8F6}" _reg_desc_ = "Python Test COM Server"...
6
by: Nathan Sokalski | last post by:
I want to set up SQL Server on Windows XP Pro so that I can use the database capabilities of ASP and IIS. I am probably using some incorrect settings, but I am not sure what they are. Here is what...
9
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
0
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: ...
0
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
14
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.