?
Solved

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

Posted on 2010-08-20
7
Medium Priority
?
1,314 Views
Last Modified: 2013-12-13
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

0
Comment
Question by:saabStory
  • 3
  • 3
7 Comments
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 1500 total points
ID: 33488249
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
 
LVL 8

Assisted Solution

by:Jessie Gill, CISSP
Jessie Gill, CISSP earned 500 total points
ID: 33488362
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
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 1500 total points
ID: 33488412
Did you copy "ntwdblib.dll" to the Windows 7 computer?  Put in the PHP root and System32.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:saabStory
ID: 33488713
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
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1500 total points
ID: 33489041
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
 

Author Comment

by:saabStory
ID: 33489465
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
 

Author Closing Comment

by:saabStory
ID: 33835325
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question