Welcome to WebmasterWorld Guest from 54.198.46.95

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Connecting to SQL Server 2005

     
4:59 pm on Nov 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is driving me up the wall: why does PHP not want to connect to the local SQL Server? I've got some ASP.NET apps that connect to it fine, but with PHP, it just says it can't connect to the server. Is there anything I need to configure? It's PHP running off CGI on IIS on a Windows box with MSSQL Server Express 2005 installed.
7:56 pm on Nov 5, 2007 (gmt 0)

5+ Year Member



Make sure Named Pipes and TCP/IP connections are enabled on SQL server 2005--this is the most common reason for connection failure, as both are disabled by default on a fresh install.
10:04 pm on Nov 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep they're on!
10:22 pm on Nov 5, 2007 (gmt 0)

5+ Year Member



In that case, are you sure that the PHP MSSQL extension was installed?

Also make sure that you're connecting to "localhost/SQLEXPRESS" (or whatever your SQL server instance name is). Connecting directly to localhost probably won't work for a SQL Express installation unless you changed a few defaults.

If all this fails, try replacing ntwdblib.dll in your PHP folder with an older version (there's a known issue with the current version distributed with the Windows PHP installation), then restart IIS for good measure.

10:48 pm on Nov 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Where do I get this older version from?
3:55 am on Nov 6, 2007 (gmt 0)

5+ Year Member



I don't have a link off-hand--I remember finding it in the user comments for the documentation of the mssql_connect() function on php.net.
8:18 pm on Nov 6, 2007 (gmt 0)

5+ Year Member



I just got this link in a MSDN Flash e-mail:

Microsoft SQL Server 2000/2005 Driver [microsoft.com]

8:03 pm on Nov 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah I've seen that, but I don't know whether to install it.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month