PHP - Can't get the MS drivers to work on IIS7 and SQL 2005 - am seriously desperate here!!!

I'm in a really bad fix.  I have an application that must be done with a week and I cannot get the MS PHP SQL drivers to work for me at all.  They show up in phpinfo() and are in the php stream.  But when I try to use them to connection I get:

[see code block below]

Now, I don't have SQL 2008, just 2005, but I thought I saw somewhere that I needed these drivers because of Server 2008.  I'm going absolutely nuts trying to get this working.  I've been told that if I miss the deadline, that 'heads will roll'.

If I could offer a 1000 points I would - so help me out here....

With Server 2008/IIS7 and SQL 2005:

1. Do I need to use the Microsoft PHP SQL drivers to access a SQL 2005 db throught IIS7?

2. If not, are there any special tricks to using the MSSQL on that plat form.  I've got a development environment running with server 2003 and sql2005 and mssql works fine, but the other day, before I ran down the new driver rabbit hole, I couldn't connect with php_mssql.dll either. The driver is currently not loading and I don't want to run a reset during the middle of the date. I've restarted the web server and recycled the app pools with no effect yet.

3. Also, I've found that 'net stop ...' is no longer an option in IIS7.  Is there a new command for the same thing or just make do with iisreset?

Thanks in advance for any help -
Unable to connect.
Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires either the Microsoft SQL Server 2008 Native Client (SP1 or later) or the Microsoft SQL Server 2008 R2 Native Client ODBC Driver to communicate with SQL Server. Neither of those ODBC Drivers are currently installed. Access the following URL to download the Microsoft SQL Server 2008 R2 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires either the Microsoft SQL Server 2008 Native Client (SP1 or later) or the Microsoft SQL Server 2008 R2 Native Client ODBC Driver to communicate with SQL Server. Neither of those ODBC Drivers are currently installed. Access the following URL to download the Microsoft SQL Server 2008 R2 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712 ) [1] => Array ( [0] => IM002 [SQLSTATE] => IM002 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ) )

Open in new window

saabStoryAsked:
Who is Participating?
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
According to a couple of other questions here, "ntwdblib.dll" is a required part of mssql PHP files.  Worse yet, there are apparently two versions: http://www.php.net/manual/en/mssql.requirements.php
0
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
You need to tell which version of PHP you're using and show us your connection code although you can hide you private details like username and password.  Are you using the same code on both servers?
0
 
Jessie Gill, CISSPConnect With a Mentor Technical ArchitectCommented:
You could take the mssql dll files from PHP 5.2 and use them if you are using php5.3.  I am assuming you know how to edit the php.ini file to allow the dll to laod.  after you use the DLL restart IIS.  I am also using iis7 php and mssql.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
Did you copy "ntwdblib.dll" to the Windows 7 computer?  Put in the PHP root and System32.
0
 
saabStoryAuthor Commented:
Sorry - in way too much of a hurry

connection is below in the code box.  Am using PHP 5.2.14 with FastCGI.  Same code on both servers.  My server is server 2003 and the work production box is server2008.

I haven't tried the ntwdblib.dll yet.  But that reminded me that I forgot to copy my working copy of the dll.  I've done that and am getting MSSQL showing now but still can't connect with mssql:

"PHP Warning:  mssql_connect() [function.mssql-connect]: Unable to connect to server:  10.10.10.113 in [server path].phpinfo.php on line 7" - which is where I make the connection.

I've pinged the SQL server from the box and get a reply so the web server can see the SQL server.




<?php
	$myServer="serverIP";
	$myUID = "loginName";
	$myPW = "loginPassword";
	$myDB = "database";
	$conn = mssql_connect($myServer,$myUID,$myPW)
	or die("Couldn't connect to SQL Server on ".$myServer." because: ".mssql_get_last_message());

	$db = mssql_select_db($myDB, $conn)
	or die("Couldn't open database ".$myDB);

	mssql_query ( 'SET TEXTSIZE 65536' , $conn );
	ini_set ( 'mssql.textlimit' , '65536' );
	ini_set ( 'mssql.textsize' , '65536' ); 
?>

Open in new window

0
 
saabStoryAuthor Commented:
I've got a version that has been working for me for ages and I've never had any difficulty at all getting this to work before.  This is a new job for me and the network is very virtualized and different from what I've used to.  In desperation, I created a DSN on the web server and was able to connect with ODBC but I'm not up on the odbc commands like I am with the mssql ones.  I've got to wonder if there's something on the SQL server that is preventing me from connecting even though I'm using the same login as our DNN site.  

I'll have to ask the IT director if there's anything there that would prevent such a connection.
0
 
saabStoryAuthor Commented:
Sorry to let this hang for so long guys - got busy, etc, etc.  Never did find a solution - created a DSN and am using the ODBC drivers.  Pretty crude but it works right now and buys me some time down the road to resolve it once and for all.

Since you both took time to answer me, I'll just divide points by the number of responses, if that's okay.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.