Categories
PHP

Connecting to a MSSQL on OS X running MAMP PRO

Versions: PHP5.6, MSSQL 2008, OS x El Capitan

I’m trying to query a MSSQL database to compare results with a MySQL database. I can query the MySQL db without issue, I cannot query the MSSQL db. I’ve installed freetds, odbc, autoconf, followed multiple tutorials including:

I’ve also tried using Propelorm without success.

Checks:
– myssql.so is in the extensions folder and is being called in my php.ini.
– I’ve tried running a try/catch on my 500 error, no good.
– apache and php logs don’t show anything in regards to the page I’m loading or the service in general.
– php.info show the correct extensions file and the correct directory to call the extension, a search in the page did not spit back anything with “mssql” or “pdo_dblib”.

My next course of action is to create a virtual machine running Ubuntu to test the script but I would like to be able to develop on my host machine.

Looking at the php.ini for php5.6.31 (version being used by MAMP PRO):

/Applications/MAMP/bin/php/php5.6.31/conf/php.ini

 421 ; Directory in which the loadable extensions (modules) reside.
 422 extension_dir = "/Applications/MAMP/bin/php/php5.6.31/lib/php/extensions/no-debug-non-zts-20131226/"

 531 ; Extensions
 532 
 533 ;extension=apcu.so
 534 extension=mssql.so
 535 extension=pdo_dblib.so
 536 extension=imap.so
 537 extension=mcrypt.so
 538 extension=gettext.so
 539 extension=pgsql.so
 540 extension=pdo_pgsql.so
 541 
 542 ;extension=imagick.so
 543 ;extension=tidy.so
 544 extension=oauth.so

Taking a look in the extensions folder, we can see the mssql.so file:

/Applications/MAMP/bin/php/php5.6.31/lib/php/extensions/no-debug-non-zts-20131226/

apcu.so                         mcrypt.so                       tidy.so
gettext.so                      memcached.so                    uploadprogress.so
igbinary.so                     mssql.so                        xcache.so
imagick.so                      oauth.so                        xdebug.so
imap.so                         opcache.so                      yaml.so
ioncube_loader_dar_5.6.so       pdo_pgsql.so                    yaz.so
ioncube_loader_dar_5.6_ts.so    pgsql.so

I’m not sure what else to include, let me know in the comments and I will update the questions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s