How to Install MSSQL PHP Extension on WHM/cPanel Linux Server

Richard 6 Min Read
How to Install MSSQL PHP Extension on WHM-cPanel Linux Server

Tutorial Install MSSQL PHP Extension on WHM/cPanel Linux Server.

For enabling MSSQL PHP extension we can’t use EasyApache. We need to install FreeTDS and configure it on the server. Currently, there are no available scripts for direct downloading MSSQL, there is no way to enable MSSQL via cPanel itself since this is not part of EasyApache. You can always follow the steps noted here to try to manual installation of MSSQL.

Install MSSQL PHP Extension on Linux Server

Before the MSSQL installation, you need to install below modules on the server :

  • 1) unixODBC
  • 2) freeTDS
  • 3)
Recommended Article: How to use Fail2ban to secure Linux Server

Install MSSQL using the following steps :

1) Install unixODBC package using the below command.

wget tar -xvf unixODBC-2.2.12.tar.gz cd unixODBC-2.2.12 ./configure -prefix=/usr/local -enable-gui=no make make install 

2) Install freeTDS package using the below command.

Download from

wget tar -xvf freetds-0.82.tar.gz ./configure -with-tdsver=8.0 -with-unixODBC=/usr/local make make install 

3) Configure FreeTDS

FreeTDS is a set of library functions that combined with the UnixODBC driver, allows your Linux server and applications to support MSSQL server.

Locate the freetds.conf configuration file in the server, the default location will be in /usr/local/etc/freetds.conf

[MSHOSTNAME] host = MSHOSTNAME port = 1433 tds version = 8.0 

4) In cPanel server most of the extensions files are located on /home/cpeasyapache/src/php-x.x.x/ext. So navigate to that folder and do the below command to install MSSQL.

cd /home/cpeasyapache/src/php-x.x.x/ext/mssql phpize ./configure make make install 

The above commands will install MSSQL on the server and a copy of in the installed extensions directory. Check and make sure that is there and add the following to php.ini using the below command.

php -i | grep php.ini 

Configuration File (php.ini) Path => /opt/cpanel/ea-php56/root/etc

Loaded Configuration File => /opt/cpanel/ea-php56/root/etc/php.ini

vi /opt/cpanel/ea-php56/root/etc/php.ini  extension=”” 

Restart httpd for enable the changes:

service httpd restart

Check the installed modules using the below command:

php -m | grep mssql mssql 
View More Posts
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

    Leave Your Comment

    Your email address will not be published.

    We are by your side every step of the way

    Think about developing your online business; We will protect it compassionately

    We are by your side every step of the way


    7 days a week, 24 hours a day