Technically speaking, FreeTDS is an open source implementation of the TDS (Tabular Data Stream) protocol used by these databases for their own clients. It supports many different flavors of the protocol and three APIs to access it. Additionally FreeTDS works with other software such as Perl and PHP, providing access from those languages as well.
For enabling mssql support in PHP on cpanel/WHM installed server we can’t use easyapache in this case, we need FreeTDS installed and configured which is a set of Unix/Linux libraries that implement the TDS protocol. I needed a solution that would be simple to maintain — in other words, something that didn’t have to be done over and over each time PHP was upgraded.
First we will need to download and install FreeTDS, you can find more information and download link at http://www.freetds.org URL. Note the exact installation steps below :
- unixODBC
- freeTDS
- mssql.so
step :1 unixODBC
yum install unixODBC unixODBC-devel
Step :2 freeTDS
cd /usr/local/src wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz tar zfvx freetds-stable.tgzcd freetds-*; ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld; make ; make install echo "--with-mssql=/usr/local/freetds" >> /var/cpanel/easy/apache/rawopts/all_php5 touch /usr/local/freetds/lib/libtds.a touch /usr/local/freetds/include/tds.h
Use this line if you get any error like no such file or directory
ln -s /usr/include/sqlext.h /usr/local/include/sqlext.h
If it it is a 64 bit server then make the following softlink
ln -s /usr/local/freetds/lib/ /usr/local/freetds/lib64
Step :3 mssql.so
Now, recompile PHP/Apache through EasyApache. It’s OK to use the same options as previous, because MSSQL isn’t an option in EasyApache that can be toggled on and off; we did it manually (and permanently) in the last step.
Verify your work by checking phpinfo() for the mssql section.
/scripts/easyapache
Now you can check Mysql enabled
root@server [~]# php --info |grep "mssql" MSSQL Support => enabled