Solved

Setting up MSSQL connection using IIS7 and PHP 5

Posted on 2011-02-11
17
812 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
This article discusses how to implement server side field validation and display customized error messages to the client.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
The viewer will learn how to count occurrences of each item in an array.

734 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