cPanel INSTALLATIONS

Install MSSQL extension in cPanel

To enable mssql extension in cPanel, you need to install FreeTDS on the server. FreeTDS is re-implementation of C libraries originally marketed by Sybase and Microsoft SQL Server. It allows many open source applications such as Perl and PHP to connect to Sybase or Microsoft SQL Server. FreeTDS is a set of Unix/Linux libraries that implement the TDS protocol.

 

Installtion:

You can check the available versions of FreeTDS package from Here

 
cd /usr/local/src
wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz
tar -xzvf freetds-*
cd freetds-*/
./configure --prefix=/usr/local/freetds --with-tdsver=7.2 --enable-msdblib --with-gnu-ld
make
make install

Please note that the option –with-tdsver=8.0 will not work now. You can use the option –with-tdsver=7.2 instead. Read the Versions of the TDS Protocol, by Product Here

Please add the following lines in /etc/ld.so.conf file if you completed the installation.

 
/usr/local/freetds/lib
/usr/local/freetds/bin

Run the following command to build dynamic links for the shared libraries:

 
ldconfig -v

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.

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

Possible errors with EasyApache

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

Please touch the following files for PHP’s conditional check

 
touch /usr/local/freetds/lib/libtds.a
touch /usr/local/freetds/include/tds.h

Error 2:
 
configure: error: Could not find /usr/local/freetds/lib64/libsybdb.a|so

You will receive the above error if you are on a 64bit platform. You will need to create a symlink from the original location of the libaray like below:

 
cd /usr/local/freetds
ln -s lib lib64

Also add the path [highlight color=”gray”]/usr/local/freetds/lib64[/highlight] to the [highlight color=”gray”]ld.so.conf[/highlight] and run:

 
ldconfig -v

Recompile PHP/Apache

Now, recompile PHP/Apache through EasyApache by keeping the same options as previous, because MSSQL is not listed in EasyApache’s options list. We manually installed already on the server.

 
/scripts/easyapache --build

Check the mssql extention is properly installed on the server using the following command once the build completes.

 
php -m |grep mssql

That’s it!!

If you like the post and wish to receive more articles from us, please like our FB page: If you like this post and wish to receive more articles from us, please like our FB page: Button

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at info@grepitout.com

2 Comments

Click here to post a comment

Topics