Installing MSSQL Module for PHP on Mac OS X

Installing the MSSQL module for Mac OS X

Install FreeTDS

  • Create the directory /usr/local/freetds
  • Download the latest version of freetds (http://www.freetds.org/software.html)
  • 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 (http://php.net/downloads.php)
  • Cd into the php directory in terminal
    • i/e cd ~/Downloads/php-5.3.6
  • 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.6/ext/mssql
  • phpize it! (type phpize)
  • Configure mssql to run with freetds
    • Type
      ./configure --with-mssql=/usr/local/freetds

      and press enter

  • Type “make” and press enter
  • Open finder and go to the mssql module directory (~/Downloads/php-5.3.6/ext/mssql/modules/)
  • Copy mssql.so 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/
    • Paste the mssql.so 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 “extension=mssql.so” on the line below the other extensions
  • Restart MAMP!

Test it!!!!!


About Benjamin Walters

My twitter is ieatyourcode. Drop me a line if you have projects or want to shoot the sh*t with someone who codes for a living :)
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>