安装 PHP 7 MongoDB 客户端/驱动程序? [英] Installing the PHP 7 MongoDB Client/Driver?

查看:28
本文介绍了安装 PHP 7 MongoDB 客户端/驱动程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常渴望开始使用 PHP 7 但是有一个问题妨碍了我...我主要使用 MongoDB 作为数据库,问题是我不知道如何安装 MongoDB 驱动程序/客户端用于 PHP 7.

I am very eager to start working with PHP 7 however one issue is getting in the way... I primarily use MongoDB for the database, and the problem is that I don't know how to install the MongoDB driver/client for PHP 7.

我当前的安装是 PHP 5.6,在我的 Mac 上,brew install php56-mongo 可以解决问题.

My current installation is PHP 5.6 and on my Mac and brew install php56-mongo does the trick.

谁能推荐我如何在我的 Mac 或 Ubuntu 安装上使用它?

Can anyone recommend how I can get this working on my Mac or an Ubuntu install?

提前致谢,非常感谢!

推荐答案

PHP 版本 5.99.99 或更早版本 的 Mongo 扩展已被取代:

The Mongo extension for PHP Version 5.99.99 or older has been superseded:

https://pecl.php.net/package/mongo

使用更新的 PHP 版本 7.99.99 或更低版本代替:

Use the newer one for PHP Version 7.99.99 or older instead:

https://pecl.php.net/package/mongodb

您可以自动安装一个 PECL/PEAR 扩展:

pecl install mongodb

手动.

也发生了变化:

new MongoClient(); // legacy class!

http://php.net/manual/en/book.mongo.php

new MongoDBDriverManager(); // new classes! 

http://php.net/manual/en/set.mongodb.php

可在此处找到有关兼容性的其他信息:

Additional information regarding compatibility can be found here:

https://docs.mongodb.org/ecosystem/drivers/php/#兼容性

这篇关于安装 PHP 7 MongoDB 客户端/驱动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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