Archive for the ‘Linux’ Category

How To Install mssql extension for PHP in cPanel CentOS / RHEL

By compiling PHP with mssql extension support one can have capability to connect to MS SQL server from a PHPLinux environment.

For enabling mssql support in PHP we need FreeTDS installed and configured which is a set of Unix/Linux libraries that implement the TDS protocol.

This post explains the steps for doing this, lets get started.

First we will need to download and install FreeTDS, you can find more information and download link at URL. Note the exact installation steps below :

cd /usr/local/src
tar -xzvf freetds-stable.tgz
cd freetds-*/
./configure –prefix=/usr/local/freetds –with-tdsver=8.0 –enable-msdblib –enable-dbmfix –with-gnu-ld
make install

Once the installation is complete we will add the related FreeTDS libraries and binaries installation path to the dynamic linker binding config files at /etc/ , we will add below two paths :


Edit the config file using vi or editor of your choice to add above paths and then use ldconfig command to build dynamic links for the shared libraries :

vi /etc/
ldconfig -v

You can check connectivity to external MS SQL server using below command :

tsql -S [servername] -p [port]  -U [username] -P [password]

Standard MS SQL port is 1443 which you can use above. Also if you want to have VPS/Server level connectivity configuration for MS SQL you can configure the/usr/local/freetds/etc/freetds.conf file for that.

Once done , we will proceed with rebuilding PHP using the /scripts/easyapache script on the cPanel servesr/vps. For a none-cpanel installation same config parameter can be used during configure step for compiling PHP.

We need to add the configure parameter –with-mssql=/usr/local/freetds in file /var/cpanel/easy/apache/rawopts/all_php5 . Once done, save the file and proceed with easyapache script to rebuild PHP.


If you are on a 64bit platform , you may recieve this error :

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

You will need to create a symlink from the original location of the libaray, the path can vary depending on the platform. In my case I noticed the file was located at normal lib directory under freetds i.e. it was located at /usr/local/freetds/lib , so I simply created a symlink named lib64 to the oringal directory lib as follows :

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

Also added the path /usr/local/freetds/lib64 to the file and build the dynamic linking as done above.

Once easyapache script completes successfully, you will find mssql support enabled in PHP. You can verify that using below command :

php -i | grep mssql

Now we will create/install a copy of libaray which we can then enable in the php.ini file. On cPanel system this can be achieved by following below steps :


cd /home/cpeasyapache/src/php-5.2.17/ext/mssql/
make install

This will install a the library at the extension_dir path mentioned in php.ini file located at /usr/local/lib/. To enable the extension add below link in php.ini file :

Save the file and restart Apache.

Install and Configure DNS on Linux Server

You would need to configure DNS server on the server, like bind:
yum install bind bind-utils

backup your bind config
mv /etc/named.conf /etc/named.conf_backup

create and edit new config

pico /etc/named.conf

and paste this config to the file:

options {
recursion no;
allow-query { any; };
allow-query-cache { any; }
zone “” {
type master;
file “/var/named/”;

than you should create your domain zone file:

pico /var/named/

#dns zone begin
$TTL 3600 IN SOA SKRS969.local. root.SKRS969.local. (2015021702 10800 3600 604800 86400) IN NS IN NS IN MX 10 IN A
ns1 IN A
ns2 IN A
mail IN A
#dns zone end

where – this server IP (dns server with bind) – your MX mail server IP – your webserver IP

or if dns, web and mail server are located on the same server – put one IP

restart DNS bind service:

/etc/init.d/named restart

Than you should registered nameservers for your domain in your domain registration site ( , and than change NS for your domain to and

Before changing NS on registrator site you can check is your bind work properly:

#dig @localhost

you should get something like:



Network Interface keeps going down on CentOS

You will usually find issue with CentOS with the NIC going down after a reboot in order to fix the issue

add these lines to the kernel line in grub:

pci_aspm=off pcie_aspm=off

(adsbygoogle = window.adsbygoogle || []).push({}); //--> Feedjit Flag Counter