Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Install / Enable PHP MsSQL Extension in cPanel/WHM Server  (Read 6849 times)

0 Members and 1 Guest are viewing this topic.

rohitj

  • Guest
Install / Enable PHP MsSQL Extension in cPanel/WHM Server
« on: November 16, 2013, 09:14:07 pm »
Installing MsSQL extension on cPanel/WHM server.


Currently there is no script for installing php mssql extension in cpanel server. You have to install it manually.

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

Download source file and install using following steps.

-------
~]# 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 sure you use gui option set as 'no' else it will show error message as it don't have Qt package)
~]# make
~]# make install
------

Install freeTDS package

--------
1. Download from ftp://ftp.freetds.org/pub/freetds/old/0.82/freetds-0.82.tar.gz
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. default location is /usr/local/etc/freetds.conf

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

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

phpize
./configure
make
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

---------
# php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

# vim /usr/local/lib/php.ini
extension=”mssql.so”

-----------
Restart httpd and check the modules using the following command.

~]# php -m | grep mssql
mssql