Home » Php » php – How to add ODBC to MAMP on OSX

php – How to add ODBC to MAMP on OSX

Posted by: admin July 12, 2020 Leave a comment


I’m trying to get ODBC to work on MAMP. I have tried many suggestions and solutions including those already on stackoverflow:

MAMP: Adding ODBC or SQL Server support ,
How do I add an ODBC driver to a MAMP environment?

None are successful so far.

This is the latest I tried.

I downloaded the latest ODBC connector:
Installed it with the OSX DMG

I than added the driver in iODBC

I keep getting this message:

Specific driver could not be loaded


No suitable image found. Did find: /usr/local/lib/libmyodbc5w.so mach-o, but wrong architecture

Any suggestions?

How to&Answers:

Looks like you are right about the 32-bit only of iODBC.

You will need to download the Source, and compile from scratch. You will also need to download XCode through the AppStore first, so you have access to gcc and cmake.

Source Code Link: http://www.iodbc.org/downloads/iODBC/libiodbc-3.52.7.tar.gz

Note: From the CLI you can run the lipo -detailed_info /path/to/binary command. This would give you detailed information about a specified binary.


I struggled with this problem for MANY hours (I messed with msql/php, and for years ago, so I consider myself currently a total newbie!). My problem was I couldn’t connect my PC to my new online server using ODBC (server was a mac mini running mavericks, trying to connect from a windows machine in my office via mysql odic connector). I finally found a solution that works. here is my situation and environment:

  1. I am converting from Access to MySql/PHP. Application configured as front-end / back-end.

  2. Put my server online so I could export my access back end tables to MYSQL. (some were online at another server, some were on my internal windows 2003 server. ) planning to change front end to php from access vba.

  3. Installed ODBC Administrator on mac mini (mavericks) per google searches.

  4. Went to drivers tab in ODBC Administrator. Set my drivers from USER to SYSTEM in the pulldown on the drivers page. This opened the drivers to appear on the SYSTEM tab of ODBC Administrator (prior to this, the drivers did not appear on the SYSTEM tab of ODBC Administrator).

  5. Added the DSN, the USER, the PORT, and the PASSWORD variables.

  6. I then went to my MAMP application that was running on the Mac. I clicked on [FILE], [EDIT] [TEMPLATE] [my.cnf]. This opened the configuration file. There is a warning – if this gets polluted, it screws up the entire MAMP app.

  7. I made the following change (Inserted a comment above the change).

    the bind address was just commented out. 9-5-14

bind-address =

This change does not tie MAMP to the localhost (I believe).

  1. I kept scrolling through the file. I also made the next change, and then saved the .cnf file:

    Just commented out the next line. Trying to get odbc to work. 9-5-14


This change I believe tells MAMP to allow remote connections.

  1. On PC, under Data Sources, System DSN tab, using MYSQL ODBC 5.1 driver, I set the datasource name, I set the URL of the online server (which was registered with internic), I set the port, and I entered the User and password to be the same KEYS I set in the ODBC System DSN I added on the Mac server. Then, I pulled down the database tab, and miraculously – the databases in my mac server appeared!

Hope this is helpful to another newbie! I literally worked WAY too many hours trying to find a solution, and it wound up being pretty easy once I lucked into the answer!