---
title: How-To Install pdo-dblib on cPanel Servers for Connecting to Microsoft SQL Server Databases In 9 Easy Steps
description: Need to install an MSSQL database from PHP on a server running cPanel. See our How-To guide that shows you how to install these components manually.
image: https://blog.summithosting.com/hubfs/Stock%20images/Business%20person%20working%20on%20computer%20against%20technology%20background.jpeg
---

[![Summit ](https://blog.summithosting.com/hs-fs/hubfs/Summit%20Logo-rgb-fullcolor-1.png?width=1921&height=408&name=Summit%20Logo-rgb-fullcolor-1.png "Summit ")](https://blog.summithosting.com/)

# Denver Data Center Colocation Blog

## [How-To Install pdo-dblib on cPanel Servers for Connecting to Microsoft SQL Server Databases In 9 Easy Steps](https://blog.summithosting.com/how-to-install-pdo-dblib-on-cpanel-servers-for-connecting-to-microsoft-sql-server-databases)

 \[fa icon="calendar"\] Feb 27, 2017 5:14:09 PM / by [Anthony Francis](https://blog.summithosting.com/author/anthony-francis)

- [Tweet](https://twitter.com/share)

---

**[![How-To Install pdo-dblib on cPanel Servers for Connecting to Microsoft SQL Server Databases In 9 Easy Steps](https://blog.summithosting.com/hs-fs/hubfs/Stock%20images/Business%20person%20working%20on%20computer%20against%20technology%20background.jpeg?width=750&name=Business%20person%20working%20on%20computer%20against%20technology%20background.jpeg "How-To Install pdo-dblib on cPanel Servers for Connecting to Microsoft SQL Server Databases In 9 Easy Steps")](http://content.handynetworks.com/tour-handy-networks-denver-data-center)**

**INTRODUCTION:**

We find that our customers commonly need to install an MSSQL database from PHP on a server running cPanel. However, cPanel doesn't have an option for installing FreeTDS or PDO\_DBLIB in easyapache.  We have created a quick How-To guide that shows you how to install these components manually. This guide assumes that you are using a recent build of cPanel on a 64 bit OS.

---

 

## Step 1: Getting Started

- You will need ROOT access to your cPanel server.
- You will need SSH credentials as well (this is a command line install, not something done through WHM)

## Step 2: SSH Into Your Server

- SSH into your server
- Elevate your permissions to root (using sudo or su -)

## Step 3: Install FreeTDS 

```

cd /usr/local/src/
wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz
tar xvzf freetds-patched.tar.gz
cd freetds-0.95.87/    
```

 Note that if the latest stable is a different version, you will have a different path to cd to, just look at the path that is made when the tarball is extracted

## Step 4: Edit freedts.conf to make it MS SQL friendly

Now edit /usr/local/freetds/etc/freetds.conf to make the \[global\] section look like this:

```

[global]
        # TDS protocol version
        tds version = 8.0
        client charset = UTF-8
        port = 1433

```

## Step 5: Add fteeds to /etc/ld.so.conf and make FreeTDS PHP friendly.

```

echo "include /usr/local/freetds/lib" >> /etc/ld.so.conf
ln -s /usr/local/freetds/lib/libsybdb.so.5 /usr/lib64/libsybdb.so.5
mkdir /usr/local/freetds/lib64
ln -s /usr/local/freetds/lib/libsybdb.so.5 /usr/local/freetds/lib64/libsybdb.so
ldconfig -v
```

## Step 6: Recompile PHP5 with FreeTDS using EasyApache & Verify

```

echo "--with-mssql=/usr/local/freetds" >> /var/cpanel/easy/apache/rawopts/all_php5
/scripts/easyapache
php -m | grep mssql
```

 You should see 'mssql' listed here as a module now.

 

## Step 7: Compile PDO\_DBLIB

Make sure you know your PHP version to change to the correct directory.  *NB: You will need to run these steps again if/when your PHP version changes.*

```

cd /home/cpeasyapache/src/php-5.5.32/ext/pdo_dblib
phpize
./configure --with-pdo-dblib=/usr/local/freetds/
make
make install
```

## Step 8: Add pdo\_dblib to php.ini

Edit /usr/local/lib/php.ini and add extension=pdo\_dblib.so to the extensions section. You can use whatever text editor you prefer, vi, vim, nano, etc.

## Step 9: Verify you see the pdo\_dblib module

Run this command:

```

$ php -m | grep dblib
```

The output of the command should be 'pdo\_dblib'

 

---

**CONCLUSION:**

All done! Enjoy using MSSQL DB's with PHP on a cPanel server! Honestly, I don't see a valid reason why this isn't an option in easyapache. Also note, if you are running a firewall such as CSF (which you should be) you will need to allow outbound connections to TCP 1433.

---

Handy Networks is not your typical data center. We provide a variety of colocation, dedicated server hosting, managed server hosting, managed security services, and cloud hosting services with two locations in Denver, Colorado - in **Downtown Denver** and in the **Denver Tech Center**. **[Schedule your private tour of Handy Networks Denver Data Center.](http://content.handynetworks.com/tour-handy-networks-denver-data-center)**

 

**[![Schedule Your Private Tour](https://no-cache.hubspot.com/cta/default/2039729/e2ad671e-233a-4e5d-9e0a-73b8f10cae2a.png)](https://cta-redirect.hubspot.com/cta/redirect/2039729/e2ad671e-233a-4e5d-9e0a-73b8f10cae2a)**

 

#### Written by [Anthony Francis](https://blog.summithosting.com/author/anthony-francis)

[![Watch On-Demand: Learn How Denver MSPs Grow Their Revenue with Data Center, Colocation, Hosting, and Private Cloud Services](https://no-cache.hubspot.com/cta/default/2039729/9639325e-3236-45f7-9634-5a7525dc6be6.png)](https://cta-redirect.hubspot.com/cta/redirect/2039729/9639325e-3236-45f7-9634-5a7525dc6be6)

[![Webinar Recording: How to Grow Your Web Hosting Business](https://no-cache.hubspot.com/cta/default/2039729/18476436-34c1-4db1-8466-eb8428ee10c4.png)](https://cta-redirect.hubspot.com/cta/redirect/2039729/18476436-34c1-4db1-8466-eb8428ee10c4)

### Recent Posts

### Posts by Topic

- [Managed Service Providers (15)](https://blog.summithosting.com/topic/managed-service-providers)
- [Web Hosting (9)](https://blog.summithosting.com/topic/web-hosting)
- [Data Backup (4)](https://blog.summithosting.com/topic/data-backup)

[![Share on Facebook](https://static.hubspot.com/final/img/common/icons/social/facebook-24x24.png)](http://www.facebook.com/share.php?u=https%3A%2F%2Fblog.summithosting.com%2Fhow-to-install-pdo-dblib-on-cpanel-servers-for-connecting-to-microsoft-sql-server-databases%3Futm_medium%3Dsocial%26utm_source%3Dfacebook) [![Share on LinkedIn](https://static.hubspot.com/final/img/common/icons/social/linkedin-24x24.png)](http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fblog.summithosting.com%2Fhow-to-install-pdo-dblib-on-cpanel-servers-for-connecting-to-microsoft-sql-server-databases%3Futm_medium%3Dsocial%26utm_source%3Dlinkedin) [![Share on Twitter](https://static.hubspot.com/final/img/common/icons/social/twitter-24x24.png)](https://twitter.com/intent/tweet?original_referer=https%3A%2F%2Fblog.summithosting.com%2Fhow-to-install-pdo-dblib-on-cpanel-servers-for-connecting-to-microsoft-sql-server-databases%3Futm_medium%3Dsocial%26utm_source%3Dtwitter&url=https%3A%2F%2Fblog.summithosting.com%2Fhow-to-install-pdo-dblib-on-cpanel-servers-for-connecting-to-microsoft-sql-server-databases%3Futm_medium%3Dsocial%26utm_source%3Dtwitter&source=tweetbutton&text=How-To%20Install%20pdo-dblib%20on%20cPanel%20Servers%20for%20Connecting%20to%20Microsoft%20SQL%20Server%20Databases%20In%209%20Easy%20Steps) [![Share on Email](https://static.hubspot.com/final/img/common/icons/social/email-24x24.png)](mailto:?subject=Check%20out%20https%3A%2F%2Fblog.summithosting.com%2Fhow-to-install-pdo-dblib-on-cpanel-servers-for-connecting-to-microsoft-sql-server-databases%3Futm_medium%3Dsocial%26utm_source%3Demail%20&body=Check%20out%20https%3A%2F%2Fblog.summithosting.com%2Fhow-to-install-pdo-dblib-on-cpanel-servers-for-connecting-to-microsoft-sql-server-databases%3Futm_medium%3Dsocial%26utm_source%3Demail)

Copyright 2017 Handy Networks LLC | All Rights Reserved

![](https://dc.ads.linkedin.com/collect/?pid=46071&fmt=gif)