Install PHP 5.6 MSSQL Freetds extension on CWP Linux server

by Sandeep B.

In this article we’ll install Freetds for php 5.6 On CWP control panel. FreeTDS is a set of libraries for Linux that allows your programs to natively talk to Microsoft SQL Server. Using Freetds we can connect php code in Linux to Microsoft Sql Server.

First install Freetds :

cd /usr/local/src
tar zxvf freetds-current.tar.gz
cd freetds-dev*
./configure --prefix=/usr/local/freetds --enable-msdblib
make && make install
cp include/freetds/tds.h /usr/local/freetds/include
cp src/tds/.libs/libtds.a /usr/local/freetds/lib
echo "/usr/local/freetds/lib" >> /etc/
echo "export FREETDSCONF=/usr/local/freetds/etc/freetds.conf" >> /etc/profile
ln -s /usr/local/freetds/lib /usr/local/freetds/lib64

Freetds config file is in (you need to edit the mssql details here in this conf) :


Then build php 5.6 with this option flag :



You can also add this config to CWP php “5.6.ini” via “Manual Options” and add it at the end of the file (PHP selector and php-fpm only) :


** if you didn’t see the mssql option in php option manager under cwp then reset the options “Reset Options“.

**** for php switcher you need to edit php option ini file manually from sftp/ssh to add the config option at the end of the file, ini location is listed below.

CWP php options ini file location :

##For switcher

##For selector


You can check the mssql is installed or not via phpinfo or via command line

php -m | grep mssql

If this post helps you in any way please consider a donation

Donate with PayPal :


You may also like

Leave a Comment