All Articles

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.

Published Nov 30, 2008

I am a computer scientist specializing in building machine learning powered products. I’m currently a machine learning developer at Local Logic.

1 thoughts on "SQLite3, php5 and MAMP"


Commented 2015-11-15 05:56:27

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 <code>make install</code>, I got message from compiler that `php.h` file is missing. I checked out the extension folder and saw <code>php_sqlite3.h</code> file. I copied it and renamed as <code>php.h</code>. I also leaved the original file in this directory too.

When I ran <code>make install</code> again , the compiler threw out 20 errors and 22 warnings.

The error messages were kind of

<code class="shell">./php.h:36:14: error: a parameter list without types is only allowed in a

function definition


The warning messages were kind of

<code class="shell">/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