Installing the MSSQL module in MAMP under Mac OS X Lion

This was a big challenge and after much reading and recompiling this is what finally worked for me.

My environment: MAMP 2.0.5 running php 5.3.6

credit: troubleshooting help came from: old reference:

Install FreeTDS

  • Create the directory /usr/local/freetds
  • Download freetds - the .82 version worked for me:
  • Open a terminal window
  • Untar/zip the freetds file and cd into that directory in terminal
    i/e cd ~/Downloads/freetds-0.82
  • paste this in terminal
    ./configure --prefix=/usr/local/freetds --sysconfdir=/usr/local/freetds/conf/freetds --disable-libiconv --disable-odbc
  • type "make" and press enter
  • type "sudo make install" and press enter
    Enter your password
  • You're done with freetds.....

Compile PHP

  • Download and untar/zip the latest source (
  • Cd into the php directory in terminal
    i/e cd ~/Downloads/php-5.3.14
  • Configure PHP
    Type "./configure" and press enter
    Type "make" and press enter
  • Go into the mssql extension directory
    i/e cd ~/Downloads/php-5.3.14/ext/mssql
  • phpize it! (type phpize)
  • Configure mssql to run with freetds
    ./configure --with-mssql=/usr/local/freetds
    and press enter
  • open a text editor and edit the file: ~/Downloads/php-5.3.14/ext/mssql/php_mssql.c
    change line 181 from PHP_FE_END to {NULL, NULL, NULL}

  PHP_FE(mssql_guid_string,			arginfo_mssql_guid_string)

  PHP_FE(mssql_guid_string,			arginfo_mssql_guid_string)

  • go back to terminal - you should be in ~/Downloads/php-5.3.14/ext/mssql
  • Type "make" and press enter
  • Open finder and go to the mssql module directory (~/Downloads/php-5.3.14/ext/mssql/modules/)
  • Copy to the extension directory of your php installation
  • MAMP on my machine is located here /Applications/MAMP/bin/php/php-5.3.6/lib/php/extensions/no-debug-non-zts-20090626/
  • Drag a copy of the into this folder (there should be a bunch of other .so files)
  • Go up a few directories to /Applications/MAMP/bin/php/php-5.3.6/conf/php.ini and open it.
  • Search for "extension="
  • Paste "" on the line below the other extensions
mine looks like this after editing:

    ; Extensions


Restart MAMP... Test it!!!!!