Solved

Setting up MSSQL connection using IIS7 and PHP 5

Posted on 2011-02-11
17
803 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

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…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

785 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