erikwebb's picture

Install MS-SQL PHP extension on Snow Leopard and DAMP

Similar to compiling XHProf for Snow Leopard, installing any new PHP extension is usually easy. The MS-SQL extension, specifically, requires an additional library called FreeTDS. The linking tools included do not work well with Snow Leopard and need to be replaced. Here are the steps I took to compile FreeTDS and the MS-SQL extension -

  1. Download PHP and FreeTDS sources.
    NOTE: The PHP version needs to match your DAMP (or other server) installation.

  2. Navigate to the mssql/ folder inside the PHP source -

cd /path/to/php/ext/mssql
  1. Run configure for FreeTDS -
CFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure --prefix=/usr/local/freetds --enable-msdblib --with-tdsver=8.0
  1. Run phpize and configure for the MS-SQL extension -
phpize
CFLAGS='-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5' \
./configure --with-php-config=/Applications/acquia-drupal/php/bin/php-config --with-mssql=/usr/local/freetds
  1. Copy the libtool created by the configure command in PHP into the FreeTDS source folder -
cp /path/to/php/ext/mssql/libtool /path/to/freetds/
  1. Compile and install FreeTDS -
make && make install
  1. Compile the MS-SQL extension and copy to the DAMP installation -
cd /path/to/php/ext/mssql
make
cp modules/mssql.so /Applications/acquia-drupal/php/ext/
  1. Configure PHP to load the new MS-SQL extension -
cat >> /Applications/acquia-drupal/php/bin/php.ini <<EOF
[mssql]
extension=mssql.so
EOF
  1. Restart DAMP

Tags: 

Add new comment