TECHIES WORLD

For Techs.... Techniques.... Technologies....

ApacheCpanelLinuxMysqlPHP

How to install MSSql in Cpanel server

Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications which may run either on the same computer or on another computer across a network (including the Internet).

In order to enable PHP MSSQL Extension, There are few modules need to be installed before you enable MSSQL Extension for PHP on server.

a) Txt2man
b) unixODBC
c) freeTDS
d) PHP mssql.so

Step1: Download FreeTDS

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

Step2: Extract the downloaded file

#tar zfvx freetds-stable.tgz

Step3: Install it using the below commands

#cd freetds-*;
#./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld; make ; make install

Step4: Add the compile flag for freetds to /var/cpanel/easy/apache/rawopts/all_php5

In this version, PHP 5 is the focus hence that specific file.

Add the following:

#echo "--with-mssql=/usr/local/freetds" >> /var/cpanel/easy/apache/rawopts/all_php5

*If you are using other Builds of Apache or PHP you may refer to the following for the correct file to edit instead of /var/cpanel/easy/apache/rawopts/all_php5 such as the case here.

* Apache 1.3.x - /var/cpanel/easy/apache/rawopts/Apache1
* Apache 2.0.x - /var/cpanel/easy/apache/rawopts/Apache2
* Apache 2.2.x - /var/cpanel/easy/apache/rawopts/Apache2_2
* All PHP 4.x versions - /var/cpanel/easy/apache/rawopts/all_php4
* All PHP 5.x versions - /var/cpanel/easy/apache/rawopts/all_php5
* Mod_suPHP - /var/cpanel/easy/apache/rawopts/all_suphp
* Specific PHP Version - /var/cpanel/easy/apache/rawopts/PHP-X.X.X
Step5: Touch the following files as these are what are checked for by PHP. The following error will result if they are not in place.

configure: error: Directory /usr/local/freetds is not a FreeTDS installation directory

Here are the files to create for PHP's conditional check:

#touch /usr/local/freetds/lib/libtds.a
#touch /usr/local/freetds/include/tds.hp

Step6: Now run Easy Apache and make sure that Mysql, Mysql of the system, amd Mysqli are all selected.

Step7: Simply build.

#/scripts/easyapache
Note:

If running a 64bit OS and get an error about

configure: error: Could not find /usr/local/freetds/lib64/libsybdb.a|so
you'll need to link a directory.

In this example it was an easy fix.

#cd /usr/local/freetds/
#ln -s /usr/local/freetds/lib lib64
#ll /usr/local/freetds/lib64/libsybdb.a
#ll /usr/local/freetds/lib64/libsybdb.so
#/scripts/easyapache

Leave a Reply