Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Setting up MSSQL connection using IIS7 and PHP 5

Posted on 2011-02-11
17
Medium Priority
?
823 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
15 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 84

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 84

Accepted Solution

by:
Dave Baldwin earned 1500 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 84

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 84

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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

824 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