SQLite3, php5 and MAMP

The version of php5 bundled with MAMP doesn’t come with sqlite3 support built-in out of the box. Here’s how to add it, considering the following setup :

  • SQLite3 installed through MacPorts
  • php5 used through MAMP

I used the php-sqlite3 extension. When you run phpize, make sure you are actually using the one from MAMP by calling it with its full path  /Applications/MAMP/bin/php5/bin/phpize.

I then complied the extension with the following flags (both paths are the defaults for macports and MAMP) :

./configure --with-sqlite3=/opt/local/ --with-php-config=/Applications/MAMP/bin/php5/bin/php-config

The make install didn’t copy the librarie to the right php folder :

>make install
Installing shared extensions:     /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/

Make sure that folder is the right one. You can find your dynamic extensions folder in your php.ini file.

1 thought on “SQLite3, php5 and MAMP

  1. Alexey

    Hello, I know that is more than 7 years passed, but I didn’t find the solution more understandable then this. So now I’ve got MAMP 3.4 and OS X Yosemite. I did all just like in this instruction. But when I ran make install, I got message from compiler that `php.h` file is missing. I checked out the extension folder and saw php_sqlite3.h file. I copied it and renamed as php.h. I also leaved the original file in this directory too.
    When I ran make install again , the compiler threw out 20 errors and 22 warnings.
    The error messages were kind of
    ./php.h:36:14: error: a parameter list without types is only allowed in a
    function definition

    The warning messages were kind of
    /php.h:36:1: warning: type specifier missing, defaults to 'int'

    I don’t know C and C++ and I can’t fix it by myself.
    I don’t know where to get more stable version of this extension and don’t know what to do now.
    Have you encountered with this compiler behavior? And if so, could you please explain more detail how you solved this problem?
    I’ll be very greateful for any hint.
    Regards, Alexey

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.