Mongodb和MAMP [英] Mongodb and MAMP
问题描述
我正在使用MAMP,并且想在PHP中使用 mongo .我陷入困境是因为我使用的MAMP的版本是我可以找到的最新版本,并且它正在运行PHP 5.2.11.我可以在 OSX 上找到的唯一Mongo PHP安装是PHP 5.3.
I am using MAMP and would like to use mongo with PHP. I am stuck because the version of MAMP I'm using is the latest version I can find, and it's running PHP 5.2.11. The only Mongo PHP install I can find for OSX is for PHP 5.3.
是否可以通过MAMP使mongo与PHP配合使用?
Is there any way to get mongo working with PHP using MAMP?
推荐答案
对于 MAMP 2.1.2 和 PHP 5.4.10
将 mongo.so 复制到
/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/
并使用temrinal
and using temrinal
cd /Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/ && wget https://github.com/downloads/stennie/mongo-php-driver/mongo.so
打开
open
/Applications/MAMP/bin/php/php5.4.10/conf/php.ini
找到; Extensions
添加
extension=mongo.so
重新启动MAMP.
以上步骤将安装MongoDB驱动程序1.2.10.
Above steps will install MongoDB driver 1.2.10.
要使用PECL安装最新的Mongodb驱动程序
-
使用自制软件或Mac端口安装 autoconf
brew install autoconf
从将未压缩的php源文件夹从 php-5.4.10 重命名为 php 并将其粘贴到该文件夹中
rename uncompressed php source folder from php-5.4.10 to php and paste it in this folder
/Applications/MAMP/bin/php/php5.4.10/include/
使用终端打开php文件夹并运行./configure
cd /Applications/MAMP/bin/php/php5.4.10/include/php/ && ./configure
将MAMP箱添加到您的~/.bash_profile
echo "export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile
安装最新的mongo
install latest mongo
pecl install mongo
重新启动MAMP服务器:).
restart MAMP server :).
这篇关于Mongodb和MAMP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!