This post will help you in configuring your cPanel server to support remote MS-SQL servers.
First step – Install freetdns / odbc
yum install unixODBC unixODBC-devel cd /usr/local/src wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz tar zfvx freetds-stable.tgz cd freetds-* ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld make make install touch /usr/local/freetds/lib/libtds.a touch /usr/local/freetds/include/tds.h ln -s /usr/local/freetds/lib/ /usr/local/freetds/lib64
Next, edit the file: /var/cpanel/easy/apache/rawopts/all_php5
Add the following code –
Now we will need to re-build EasyApache, so it will implement the changes –
You can verify it is now supported using php –
php --info |grep "mssql" php -i | grep odbc
Edit the file “/usr/local/lib/php.ini” , and make sure odbc.so is listed like this:
extension = odbc.so
Restart your httpd service – /scripts/restartsrv_httpd
The remote MSSQL server you would like to connect to, should be listed in the “/usr/local/freetds/etc/freetds.conf” file, and whiltelisted in your cPanel server firewall.
Here is an example for the freetds.conf file –
[192.168.1.110] host = 192.168.1.110 port = 1433 tds version = 7.0 [192.168.1.111] host = 192.168.1.111 port = 1433 tds version = 7.0
(You can try tds version 8 if that doesn’t work)Tags: cPanel, freetds, mssql, odbc