homepage Welcome to WebmasterWorld Guest from 67.202.56.112
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Connecting to SQL Server 2005
ahmedtheking




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

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.

 

WesleyC




msg:3497007
 7:56 pm on Nov 5, 2007 (gmt 0)

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.

ahmedtheking




msg:3497131
 10:04 pm on Nov 5, 2007 (gmt 0)

Yep they're on!

WesleyC




msg:3497144
 10:22 pm on Nov 5, 2007 (gmt 0)

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.

ahmedtheking




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

Where do I get this older version from?

WesleyC




msg:3497365
 3:55 am on Nov 6, 2007 (gmt 0)

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.

WesleyC




msg:3498098
 8:18 pm on Nov 6, 2007 (gmt 0)

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

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

ahmedtheking




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved