Advance

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
0
(0)

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) mssql.so
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 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  

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

View More Posts
Richard
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 a Reply

Your email address will not be published. Required fields are marked *

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

+8595670151

7 days a week, 24 hours a day