Solved

Connect to MS-SQL server from Linux/PHP

Posted on 2016-10-12
8
111 Views
Last Modified: 2016-10-27
I'm migrating a website over to a LAMP stack from a windows machine. Everything is going smoothly except for all the PDO exceptions. The PDO was using the "sqlsrv" driver, however that driver is no longer found. (We are moving to a debian server, and I can't find the driver in the debian package repos).


Anyways I need to know how either where to find a linux build for the sqlsrv driver. Or an alternative driver that does support linux. Thanks.
0
Comment
Question by:rcimasi
[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
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41841180
Linux does not have an equivalent driver.  There is the old 'mssql' driver but it does not have all the features that 'sqlsrv' does.  This article https://www.experts-exchange.com/questions/27424576/Looking-for-examples-on-connecting-to-MS-SQL-Server-with-freetds-in-C.html is the best description I have for the process on Linux.
0
 
LVL 78

Expert Comment

by:arnold
ID: 41841181
On Linux freetds, which SQL server is being used, which Linux is are you using?
1
 
LVL 62

Expert Comment

by:gheist
ID: 41841507
... and long learning to not copy and paste DB connection strings around the application.
0
Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

 
LVL 50

Expert Comment

by:Vitor Montalvão
ID: 41841509
0
 

Author Comment

by:rcimasi
ID: 41842021
Thanks everybody, So far I see that mssql and JDBC are valid drivers. But how do I install then to be used in the PDO driver?


I'm using Debian Jessie with apache2.
0
 
LVL 50

Expert Comment

by:Vitor Montalvão
ID: 41842027
What stands for PDO?
0
 

Author Comment

by:rcimasi
ID: 41842127
PDO: PHP Datbase Object
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 41842316
There is some more 'info' on this page http://php.net/manual/en/ref.pdo-dblib.php .  The Microsoft ODBC driver for Linux has limited support.  Since it supports a current version of Ubuntu, you 'might' be able to get it to work on Debian.  https://msdn.microsoft.com/en-us/library/mt683457(v=sql.110).aspx  

In general however, there is no direct support for what you want to do.  You probably won't be able to get it to work as well on Linux as you did on Windows.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This article discusses how to implement server side field validation and display customized error messages to the client.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

724 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