duanjianfu1398
2011-08-25 07:09
浏览 55

如何使用PHP在OS X 10.5.8中启用Sqlite3?

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...

图片转代码服务由CSDN问答提供 功能建议

我想在我的MAMP堆栈上安装Symfony框架。 但是,当我尝试运行它时,Symfony抱怨我需要“安装并启用SQLite3或PDO_SQLite扩展”。 我不知道该怎么做。 我安装了sqlite3

  $ sqlite3 --version 
3.4.0 
   
 
 

此外我还有php 5.3。 6。 我看到有一个名为php5-sqlite3的MacPorts包,但它被标记为“过时端口”。

在MAMP上启用sqlite3扩展的正确方法是什么? 我有Leopard 10.5.8。

编辑:我最后通过安装MacPorts包php5-sqlite(没有3)来解决问题。 然后它仍然无法正常工作。 然后我使用+ sqlite重新安装了MacPorts php5软件包。 一切顺利。 所以,那是:

  $ sudo port install php5-sqlite 
 $ sudo port uninstall php5 
 $ sudo port install php5 + apache2 + sqlite 
  <  / pre> 
 
 

我希望能帮助任何偶然发现的人......

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • dongyong2906 2011-08-30 19:15
    已采纳

    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...

    已采纳该答案
    打赏 评论
  • doushu7588 2011-08-25 08:14

    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.

    打赏 评论
  • donglu9825 2012-01-25 01:06

    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

    打赏 评论
  • douwang6635 2013-08-15 11:01
    $ sudo port install php5-sqlite
    $ sudo apachectl -k restart
    

    Works like a charm

    打赏 评论

相关推荐 更多相似问题