Server Administration & Management

How to enable PHP MsSQL extension on cPanel

You can enable mssql extension for php on cPanel server. For this you will need to first install some supporting modules. You will need root access to install it. Before you proceed for installation it is important that you backup your php.ini, http.conf and php.conf file.

1. Below are the required module

i) Txt2man
ii) unixODBC
iii) freeTDS
iv) PHP mssql.so

2. Install unixODBC package

# cd /usr/local/src/

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

# tar -xvzf unixODBC-2.2.14-p2.tar.gz

# cd unixODBC-2.2.14-p2

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

# make

# make install

3. Install freeTDS package

# cd /usr/local/src/

# wget ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz

# tar -xvzf freetds-stable.tgz

# cd freetds-stable

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

# make

# make install

Once installation is completed it will show you configuration file path for freetds.conf note down this path in note pad.

4. Configuration freeTDS, Open file freetds.conf and add following to the bottom.

# vi freetds.conf

host = localhost
port = 1433
tds version = 8.0

5. Generating mssql.so file

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

# phpize

# ./configure

# make

# make install

6. Above steps will create a copy of mssql.so in the installed extension directory. Now locate your php.ini file and add extension as

# vi /etc/php.ini

extension = “mssql.so”

7.  Restarting apache service for php changes to take effect.

# /etc/init.d/httpd restart

Now executing php -m or create phpinfo file you will see mssql is listed in the list.

# php -m


November 20, 2011 - Posted by | cPanel, PHP | , ,

1 Comment »

  1. Hi it’s me, I am also visiting this website daily, this web site is actually good and the people are actually sharing good thoughts.

    Comment by อาคารสำนักงานให้เช่า | January 27, 2015 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: