简体   繁体   English

如何在OS X上使用PHP7在MAMP上安装mongodb php驱动程序?

[英]How to install mongodb php driver on MAMP with PHP7 on OS X?

I am having trouble installing the new mongoldb driver for PHP on MAMP 3.5 OS X El Capitan. 我在MAMP 3.5 OS X El Capitan上为PHP安装新的mongoldb驱动程序时遇到问题。 I entered the PATH to the MAMP's php7 binaries. 我输入了MAMP的php7二进制文件的路径。 I have also downloaded php7 sources, unarchive and in /Applications/MAMP/bin/php/php7.0.0/ I have created a directory include where I moved the downloaded php source (renamed the containing directory as 'php'). 我还下载了php7源文件,并在/Applications/MAMP/bin/php/php7.0.0/取消了归档,并创建了一个目录,其中include将下载的php源文件移到其中的目录(将包含目录重命名为“ php”)。 So now I have /Applications/MAMP/bin/php/php7.0.0/include/php in addition to MAMP original files. 因此,除了MAMP原始文件外,现在我还有/Applications/MAMP/bin/php/php7.0.0/include/php I am not sure if I push something forward or not. 我不确定是否要推动前进。 When I run 当我跑步

sudo pecl install mongoldb

I've got the error bellow: 我有下面的错误:

downloading mongodb-1.1.1.tgz ...
Starting to download mongodb-1.1.1.tgz (642,977 bytes)
.................................................................................................................................done: 642,977 bytes
349 source files, building
running: phpize
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012
cp: acinclude.m4: No such file or directory
cp: Makefile.global: No such file or directory
cp: config.sub: No such file or directory
cp: config.guess: No such file or directory
cp: ltmain.sh: No such file or directory
cp: run-tests*.php: No such file or directory
cat: acinclude.m4: No such file or directory
/Applications/MAMP/bin/php/php7.0.0/bin/phpize: line 155: /Applications/MAMP/bin/php/php7.0.0/lib/php/build/phpize.m4: No such file or directory
autoconf: error: no input file
ERROR: `phpize' failed

Does anybody managed to install the new mongodb php driver on MAMP on OS X? 是否有人设法在OS X的MAMP上安装了新的mongodb php驱动程序? Do I make somethings wrong? 我做错什么了吗? Any suggestions? 有什么建议么?

Some links: http://mongodb.github.io/mongo-php-driver/#installation , https://github.com/mongodb/mongo-php-driver , https://pecl.php.net/package/mongodb 一些链接: http://mongodb.github.io/mongo-php-driver/#installationhttps://github.com/mongodb/mongo-php-driverhttps://pecl.php.net/package/ mongodb

Thanks. 谢谢。

It seems that MAMP 3.5's PHP 7.0.0 version is missing the build directory in the associated lib/php directory, which is why you're getting the error: 似乎MAMP 3.5的PHP 7.0.0版本缺少关联的lib/php目录中的build目录,这就是为什么出现错误的原因:

/Applications/MAMP/bin/php/php7.0.0/lib/php/build/phpize.m4: No such file or directory

Just copy the build directory from one of the other PHP versions, eg /Applications/MAMP/bin/php/php5.6.10/lib/php/build to /Applications/MAMP/bin/php/php7.0.0/lib/php/build . 只需将build目录从其他PHP版本之一(例如/Applications/MAMP/bin/php/php5.6.10/lib/php/build复制到/Applications/MAMP/bin/php/php7.0.0/lib/php/build

I've installed a few PECL modules with this fix and they're working fine. 我已经使用此修复程序安装了一些PECL模块,并且它们工作正常。

Hopefully this is just a mistake in the MAMP packaging and will be fixed in versions after 3.5. 希望这只是MAMP包装中的一个错误,并将在3.5之后的版本中修复。

I had the same issue and this worked best for me: 我遇到了同样的问题,这对我来说效果最好:

$ brew tap homebrew/homebrew-php
$ brew install php70-mongodb

You'll need to update php.ini and add the following line: 您需要更新php.ini并添加以下行:

extension="/usr/local/opt/php70-mongodb/mongodb.so"

Restart MAMP servers, and you're done! 重新启动MAMP服务器,您就完成了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM