Robert Martin
Robert Martin

Reputation: 17157

How do I enable Sqlite3 in OS X 10.5.8 with PHP?

I want to install the Symfony framework on my MAMP stack. However, when I try to run it, Symfony complains that I need to "Install and enable the SQLite3 or PDO_SQLite extension." I don't know how to do this. I have sqlite3 installed

$ sqlite3 --version
3.4.0

Also I have php 5.3.6. I see that there is a MacPorts package called php5-sqlite3, but it is marked "obsolete port."

What is the correct way to enable the sqlite3 extension on MAMP? I have Leopard 10.5.8.

Edit: I ended up solving the problem by installing the MacPorts package php5-sqlite (without the 3). Then it still didn't work. Then I reinstalled the MacPorts php5 package using +sqlite. Then everything worked. So, that's:

$ sudo port install php5-sqlite
$ sudo port uninstall php5
$ sudo port install php5 +apache2 +sqlite

I hope that'll help anyone who stumbles onto this...

Upvotes: 1

Views: 7944

Answers (4)

talal7860
talal7860

Reputation: 415

$ sudo port install php5-sqlite
$ sudo apachectl -k restart

Works like a charm

Upvotes: 0

johansenj
johansenj

Reputation: 71

install module

sudo port install php5-sqlite

and then restart apache2

sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart

There is no need to uninstall php5

Upvotes: 4

Robert Martin
Robert Martin

Reputation: 17157

I ended up solving the problem by installing the MacPorts package php5-sqlite (without the 3). Then it still didn't work. Then I reinstalled the MacPorts php5 package using +sqlite. Then everything worked. So, that's:

$ sudo port install php5-sqlite
$ sudo port uninstall php5
$ sudo port install php5 +apache2 +sqlite

I hope that'll help anyone who stumbles onto this...

Upvotes: 1

GordonM
GordonM

Reputation: 31740

Apple's pre-built PHP is rather limited, to say the least. They've added more stuff in versions in Snow Leopard and Lion, but it still lacks various features. As far as library version numbers go, those get updated with OS Point releases from Apple. As Leopard is now two generations behind the current, I wouldn't expect Apple to be providing more than security fixes for it at this point.

You could install a third-party of PHP such as the Entropy or Liip releases. The former isn't maintained anymore but I know it works with Leopard. The latter is more up to date, but I don't know what its Leopard compatibility status is.

Failing that, you'll have to download the PHP source and start building extensions yourself. For this you'll need to install XCode, which should be on the Leopard install disc. This method is extremely fiddly and difficult, however, and is only recommended for advanced users.

Upvotes: 0

Related Questions