Tuesday, January 21, 2014

MsSQL extension on cPanel/WHM server

If there is a requirement for MsSQL extension on cPanel/WHM server, you need to install it manually by following the steps listed below.

You need to install a few modules before installing the MsSQL extension.

1. unixODBC

2. freeTDS

3. mssql.so

Do not use rpms as it will show lots of dependency errors. Better download the source file and compile it.

Install unixODBC package

1. Get the source from here

2. tar -xvf unixODBC-2.2.12.tar.gz

3. Now use the following command to configure.

./configure -prefix=/usr/local -enable-gui=no

Please note that if you use enable-gui option as yes and dont have Qt package, you will get the error. So make sure you use it as no.

4. make

5. make install

Install freeTDS package

1. Download from ftp://ftp.freetds.org/pub/freetds/old/0.82/freetds-0.82.tar.gz (Note that if you are using a latest version of freetds, sometimes you may get an error while trying to run the configure with unixODBC option. So I have to use an older version 0.82.)

2. tar -xvf freetds-0.82.tar.gz

3. ./configure -with-tdsver=8.0 -with-unixODBC=/usr/local

4. make

5. make install

Configure freeTDS

1. Locate the freetds.conf and add the following entries.

port = 1433
tds version = 8.0

Generating mssql.so

In cPanel servers the extensions are located at /home/cpeasyapache/src/php-x.x.x/ext. Navigate to the above directory and then to mssql directory.

cd /home/cpeasyapache/src/php-x.x.x/ext/mssql

make install

The above commands will generate a copy of mssql.so in the installed extensions directory. Check and make sure that mssql.so is there and add the following to php.ini


Restart httpd and check the modules using the following command.

php -m | grep mssql


You can create a phpinfo page with the following contents and search for mssql.




No comments:

Post a Comment