PHP - Install php5-mssql module

From Cosmin's Wiki

Jump to: navigation, search

Home > Linux how to's > PHP - Install php5-mssql module


The procedure

Ok, here is the fix to get php5-mssql installed:

Install the Debian Package tools:

apt-get install build-essential debhelper

Then, download the PHP5 Source Files: apt-get source php5

Get the dependencies for building PHP5:

apt-get build-dep php5
cd to the directory php5-5.1.2/debian and vi the file modulelist. Insert a line above the one that says:
mysql MySQL
with the contents
mssql MSSQL

Next, edit the file rules and search for –with-mysql=shared,/usr

Insert the following above it:


Make sure not to forget the backslash on the end. Now, we must edit the “control” file in the same directory. Add this to the end of the file:

Package: php5-mssql
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ${php:Depends}, php5-common (= ${Source-Version})
Description: MSSQL module for php5
This package provides a module for MSSQL using FreeTDS.

PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly.

Move up a directory: cd ..

Now run:


This will compile PHP5 and create the debs in the parent directory. This process takes a while, so relax.

When that is finished, cd to the parent directory and you will see your deb files.

Now, to install php5-mssql:

dpkg -i php5-mssql_5.1.6-1ubuntu2.1_i386.deb

The majority of the information from this post came from the following URL.

Important Note

Don't compile PHP5 from the server, because for some reason it uninstalls PHP5 from the server when you do that and you have to go back and reinstall everything. Also, when PHP5 gets uninstalled, of course it removes PHP5 from mods-enabled in Apache2.