Mssql for PHP in Arch Linux

roland's picture

The MSSQL module is not enabled by default in php in Arch. I don't know why but it seems there are just some weird fixes that need to be implemented. I am a noob at these stuff, but I was able to compile the module. Here is the how to:

1. Compile FreeTDS (package is created after compilation)

cd ~/abs
cp -r /var/abs/community/lib/freetds/ .
cd freetds
makepkg

Sym link the library
cd src/freetds-0.82/
ln -s src/tds/.libs/ lib

This will leave the source files and build in your file system under src.

2. Install FreeTDS (if you haven't already) either with

sudo pacman -U freetds-0.82-1-i686.pkg.tar.gz
or
sudo pacman -S freetds

3. Get and build PHP

cd ~/abs
cp -r /var/abs/extra/php .
vim PKGBUILD

After line 124 in phpextensions add this line
--with-mssql=/home/your_username/abs/freetds/src/freetds-0.82 \

NOTE: your_username is the username you use to login into the system

Build PHP:
makepkg

4. Uninstall any php install that you might have with
sudo pacman -R php

5. Install the version you compiled
sudo pacman -U php-5.2.6-5-i686.pkg.tar.gz

6. Configure php.ini
sudo vim /etc/php/php.ini

and add (line ~1299)
extension=mssql.so

Test, php -m to see that mssql is loaded

The php install might look for "libtds.a" in /usr/lib, but this has been renamed to "libct.so.4.0.0"
So, you might want to add a symlink
sudo ln -s /usr/lib/libct.so.4.0.0 /usr/lib/libtds.a

Personally, I didn't see a problem with not having it.