Ubuntu is a great Linux distribution, but MSSQL support is poor. There is nothing about MSSQL in apt-get
or Synaptic package manager. This small HOWTO fixes problem. See HOWTO: PHP with MSSQL on Ubuntu 6.06 if you are using Ubuntu 6.06 or want to try another way to reach PHP with MSSQL.
Step 1. Get the sources and packages
You must have a php5, php5-dev, php5-src and freetds.
sudo apt-get install php5 php5-dev freetds
sudo apt-get source php5
Step 2. Building MSSQL module
Apt-get will unpack php5 sources into php5-5.x.x directory. Navigate to php5-5.x.x/ext/mssql
:
sudo phpize
sudo ./configure --with-mssql
sudo make
After make you will see something like this:
...
Libraries have been installed in:
/home/snick/Software/php5-5.2.1/ext/mssql/modules
...
PHP modules located in /usr/lib/php5/20060613+lfs/ (change last directory if differs). Just copy new module:
sudo cp php5-5.2.1/ext/mssql/modules/mssql.so \
/usr/lib/php5/20060613+lfs
Step 3. Configuring PHP
Setup PHP to use new module:
sudo vim /etc/php5/conf.d/mssql.ini
Add text
extension=mssql.so
and save the file. Restart Apache.Make sure that you correctly setup /etc/freetds/freetds.conf
for your servers.