Solved

Setting up MSSQL connection using IIS7 and PHP 5

Posted on 2011-02-11
17
798 Views
Last Modified: 2013-12-13
I am trying to setup and establish a connection to our MsSQL Database Server from our Website Server. I am trying to setup the DLL, but looking in the php.ini file, I cannot find the MSSQL DLL extension at all, nor could I found the MSSQL dll. *note* I have already established a successful connection from PHP to MySQL. I am thinking one solution would be setting up an ODBC connector...

Here are the Web Server specs:
Server 2008 R2
IP Address (example 192.168.1.20)
IIS 7
PHP 5.3.5
API:CGI/FastCGI 

Open in new window

Here are the Database Server specs:
Server 2008 R2
IP Address (example 192.168.1.21)
SQL Server 2008 R2
MySQL 5.5.X

Open in new window

0
Comment
Question by:ZeterFan411
  • 8
  • 4
  • 3
17 Comments
 
LVL 4

Expert Comment

by:IceCode
ID: 34873120
Your issue may have to do with your version of ntwdblib.dll, the version shipped with PHP5 is corrupt.  Check out this post: http://www.techrepublic.com/forum/questions/101-227248 .
0
 
LVL 4

Expert Comment

by:IceCode
ID: 34874773
You also have to install the mssql library.  Did you use the GUI installer?
0
 

Author Comment

by:ZeterFan411
ID: 34889383
IceCode

I may wait out the resolution you mention for "replacing the ntwdblib.dll file", but thanks for the info. As for the installation, our company's tech resource installed it, but they are much more familiar with IIS7/.NET ~ they just put PHP in with the IIS7 installation per our request, but do not have a lot of experience with PHP + MsSQL. Though they were able to setup PHP+MySQL, their eyes kind of glazed over at the PHP+MsSQL request.

0
 
LVL 4

Expert Comment

by:IceCode
ID: 34890535
Well, if they used the GUI installer (which they likely did since it's Windows) they probably just need to run it again and choose modify.  Then they can check the box next MSSQL in the list to add it, then they just need to replace ntwdblib.dll.  It's actually not very difficult to do.  Good luck my friend.
0
 

Author Comment

by:ZeterFan411
ID: 34899129
Hmmm, any way to "change" that setting? It should be much easier to do that.
0
 

Author Comment

by:ZeterFan411
ID: 34899335
Ok Experts-exchange members,

After a bit of research, I have successfully installed the PHP Manager for IIS. What I need assistance on is the proper download and instructions for MsSQL driver.

Help anyone?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 34921827
For PHP 5.3+, you need to download Microsoft's SQL PHP driver http://www.microsoft.com/sqlserver/2005/en/us/php-driver.aspx.  The old php_mssql driver is not supported in PHP 5.3+ and will not work.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:ZeterFan411
ID: 34927366
Ok, I downloaded the driver...and found multiple .DLLs with the documentation. I don't know which one to use. Here are the steps I am assuming one should do...
 SQL Server Driver

1

Put a copy of one of the 6 dlls in the directory into the php/ext/ folder

2

I am assuming use the v9 version (php_sqlsrv_53_ts_vc9)

3

Rename DLL from php_sqlsrv_53_ts_vc9.dll  - to - php_sqlsrv_ts.dll

4

Add this line to the php.ini file: extension=php_sqlsrv_ts.dll
Only issue I am seeing here is: My MySQL and MsSQL Database are on another IP address...will the DLL even work?

0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 34929150
Yes, it should work to connect to another machine like the previous version did.

This page links to a bunch of QnA about it: http://social.msdn.microsoft.com/forums/en-US/sqldataaccess/thread/8562f2ff-d2f6-4718-826b-02ecd7c2db0c/
0
 

Author Comment

by:ZeterFan411
ID: 34954848
DaveBaldwin:

I will check out your solution...thanks
0
 

Author Comment

by:ZeterFan411
ID: 34980449
Still having issues...I continue to look for answers.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 34982982
Is the MS SQL connection the only thing not working?
0
 

Author Comment

by:ZeterFan411
ID: 34999777
DaveBaldwin

Yes. I am able to connect easily with MySQL.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 34999895
"I continue to look for answers." doesn't give us anything to go on.  Are you getting any error messages?  If so, what are they?  What tells you that it isn't working?

You can also click on "Request Attention" above and get some others to look at your question.
0
 

Author Closing Comment

by:ZeterFan411
ID: 35189041
Still haven't had my question fully answered, so accepting David's response for now.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
The viewer will learn how to dynamically set the form action using jQuery.

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now