Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Enable mssql support on Linux server  (Read 2856 times)

0 Members and 1 Guest are viewing this topic.

sajugovind

  • Guest
Enable mssql support on Linux server
« on: April 06, 2014, 06:53:05 pm »
The answer to the above question is you need to first compile freetds and then compile PHP with freetds support.

But what is FreeTDS?

FreeTDS is a free implementation of the TDS (Tabular Data Stream) protocol that is used by Sybase and Microsoft for their database products. It implements different version os TDS which includes TDS 4.2, 5.0, 7.0 and 8.0, and can communicate with any Sybase or Microsoft SQL Server. FreeTDS generally comes with a low level library (the TDS layer) along with a number of APIs (Application Programming Interfaces). The APIs are DB-Lib, CT-Lib, and ODBC.

You can install freetds by using yum.

Code: [Select]
yum install freetds
After that you need to recompile the php with mssql support

check the php version on the server and then download the same php version file

for example php 5.3.2. You can downlad php version by using this URL http://us3.php.net/downloads.php

Code: [Select]
cd /usr/local/src

wget http://us3.php.net/get/php-5.3.2.tar.bz2/from/in.php.net/mirror

tar -xzvf php-5.3.2.tar.bz2

cd php-5.3.2/ext/mssql

phpize

./configure –with-mssql

make
make install

Next look for the mssql.so file and make sure it is in the module directory specified in your php.ini. Copy it to the specified location if needed.
Code: [Select]
php -i | grep php.ini

vi /usr/local/lib/php.ini

Add this line to your php.ini:

Code: [Select]
extension=mssql.so
Save the php.ini and restart Apache:

Code: [Select]
/etc/init.d/httpd restart
Thank you,