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

How to 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.

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

1) unixODBC

2) freeTDS

3) mssql.so

Install MSSQL using the following steps

1) Install unixODBC package using the below command.

# wget http://www.unixodbc.org/unixODBC-2.2.14-p2.tar.gz

# 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 ftp://ftp.freetds.org/pub/freetds/old/0.82/freetds-0.82.tar.gz

# wget ftp://ftp.freetds.org/pub/freetds/old/0.82/freetds-0.82.tar.gz

# 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 mssql.so in the installed extensions directory. Check and make sure that mssql.so 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=”mssql.so”

Restart httpd for enable the changes.

# service httpd restart

Check the installed modules using the below command.

# php -m | grep mssql

mssql

If you need any further help please do reach our support department.

  • 0

How to Enable Plaintext Authentication in Dovecot?

How to Enable Plaintext Authentication in Dovecot? Dovecot is an IMAP or POP3 server for...

Install Apache Tomcat using EasyApache4

Install Apache Tomcat using EasyApache4 The Apache Tomcat is an Apache module that provides a...

How to Enable Extended Logging in Exim

How to Enable Extended Logging in Exim The extended Exim logs in cPanel server will help you to...

Maximum number of connections from user+IP exceeded

Maximum number of connections from user+IP exceeded If you are getting an error like ‘ Error –...

How To Set Up Remote Access Key in WHM

How To Set Up Remote Access Key in WHM Remote Access Key is a cPanel feature that allows...