带有MAMP的Mongo PHP驱动程序 [英] Mongo PHP Driver with MAMP

查看:115
本文介绍了带有MAMP的Mongo PHP驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了2天的时间尝试在配备MAMP(2.2)的Mac 10.8上安装mongo php驱动程序,但这几乎是不可能的... 我试过了: 在MAMP上安装Mongo驱动程序 还有这个 带有MAMP的Mongo PHP Driver 1.2.10

I spent 2 days trying to install mongo php driver on a Mac 10.8 with MAMP (2.2), but it's almost impossible... I've tried: Installing Mongo Driver on MAMP and this Mongo PHP Driver 1.2.10 with MAMP

我在MAMP上选择了5.4.19 php版本.

I have the 5.4.19 php version selected on MAMP.

我已经安装了mongo驱动程序:

I have installed the mongo driver doing:

sudo pecl install mongo

我没有任何错误,但是重新启动MAMP之后,我在加载过程中遇到了以下错误:

I have no errors, but once I restart MAMP I got this error on the loading process:

PHP Warning:  PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20121212
These options need to match
in Unknown on line 0

phpize的输出是:

The output of phpize is:

Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626

php -v的输出是:

The output of php -v is:

PHP 5.5.3 (cli) (built: Sep 18 2013 14:31:13) ...

因此版本与MAMP不匹配. 我试图在MAMP上选择相同的版本,但是遇到了同样的问题...

So the version doesn't match with MAMP. I have tried to select the same version on MAMP, but I got the same problem...

有任何提示吗?

非常感谢!

推荐答案

路径中的phpize正在构建PHP 5.3(API版本20090626)的扩展,但是您需要在MAMP配置中匹配PHP的API版本(对于PHP 5.4,应该是API版本20100412).看来您的路径中有另一个 版本的php,即PHP 5.5.

The phpize in your path is building extensions for PHP 5.3 (API version 20090626), but you need to match the API version of PHP in your MAMP config (which should be API version 20100412 for PHP 5.4). It looks like you have another version of php in your path, which is PHP 5.5.

要使用预期的PHP版本构建所有内容,请尝试首先将该版本的PHP放在您的路径中,例如:

To build everything with the expected version of PHP, try putting that version of PHP first in your path, eg:

export PATH=/Applications/MAMP/bin/php/php5.4.19/bin:$PATH

然后运行phpize以确保找到正确的API版本.

Then run phpize to make sure it finds the correct API version.

phpize -v报告的API版本应与php -i | grep "PHP API"报告的API版本匹配.

The API version reported by phpize -v should match that reported by php -i | grep "PHP API".

假设所有匹配项,您都应该能够按照已链接的说明进行构建.

Assuming all matches, you should then be able to build following the instructions you've linked.

这篇关于带有MAMP的Mongo PHP驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆