无法在MAMP上初始化mongoDB模块

我使用 homebrew </ code>安装了MongoDB,并安装了php mongo驱动程序并将其包含在内 在我的MAMP包的当前php版本中。 但是当我启动MAMP时,这个错误出现在我的php错误日志中:</ p>

  PHP启动:mongo:无法初始化使用模块编译的模块API = 20100525 
PHP编译的模块
Module API = 20121212
这些选项需要匹配
在第0行的未知
</ code> </ pre>

我试图用mamp文件夹中的phpize再次编译驱动程序但是得到了 相同的结果。 我对Mac和* nix环境一般都很新,有什么东西我不见了吗?</ p>

自制软件安装的PHP版本是 5.5.17 </ code >我的MAMP包中的PHP版本是 5.5.14 </ code> </ p>
</ div>

展开原文

原文

I've installed MongoDB using homebrew and also installed the php mongo driver and included it in the current php version of my MAMP package. But when I start MAMP this error is in my php error log:

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

I tried to compile the driver again with the phpize which is inside the mamp folder but got the same results. I'm very new to mac and *nix environment in general, Is there something that I'm missing?

The PHP version installed by homebrew is 5.5.17 and PHP version in my MAMP Package is 5.5.14

1个回答



如果您正在编译PHP驱动程序,则必须针对要运行它的相同PHP版本进行编译。 根据您共享的错误,驱动程序清楚地针对不同的PHP运行时编译。</ p>

Luke Peters有一个博客文章讨论如何为MAMP编译模块,它需要设置 PATH </ code>环境变量 在使用PECL构建模块之前,先到MAMP的 bin / </ code>目录。 这将确保使用适当的 phpize </ code>二进制文件。 为你的环境写一篇文章(5.5.14):</ p>

  $ export PATH = / Applications / MAMP / bin / php / php5.5.14 / bin:$ PATH  `
$ cd /Applications/MAMP/bin/php/php5.5.14/bin
$ sudo pecl install mongo
</ code> </ pre>
</ div>

展开原文

原文

If you're compiling the PHP driver, you must do so against the same PHP version that you intend to run it with. Based on the error you've shared, the driver was clearly compiled against a different PHP runtime.

Luke Peters has a blog post discussing how to compile the module for MAMP, and it entails setting your PATH environment variable to MAMP's bin/ directory before using PECL to build the module. This will ensure that the appropriate phpize binary gets used. To paraphrase his write-up for your environment (5.5.14):

$ export PATH=/Applications/MAMP/bin/php/php5.5.14/bin:$PATH`
$ cd /Applications/MAMP/bin/php/php5.5.14/bin
$ sudo pecl install mongo

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐