Solved

Setting up MSSQL connection using IIS7 and PHP 5

Posted on 2011-02-11
17
810 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 
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 83

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
 

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 83

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 83

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 83

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

732 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