在 mac os 10.15 上为 php7 安装 mongodb [英] Install mongodb on mac os 10.15 for php7

查看:138
本文介绍了在 mac os 10.15 上为 php7 安装 mongodb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的Mac Catalina 10.15上安装了mongodb.我也安装了php7.3版本.现在,我想在PHP中使用mongoClient()类.我试过 composer require mongodb/mongodb ,但是它说缺少mongodb扩展名:

I have installed mongodb on my mac Catalina 10.15. I have php7.3 version installed as well. Now, I want to use the mongoClient() class with PHP. I tried composer require mongodb/mongodb but it says that the mongodb extension is missing :

Using version ^1.5 for mongodb/mongodb
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- mongodb/mongodb 1.5.1 requires ext-mongodb ^1.6 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.5.0 requires ext-mongodb ^1.6 -> the requested PHP extension mongodb is missing from your system.
- Installation request for mongodb/mongodb ^1.5 -> satisfiable by mongodb/mongodb[1.5.0, 1.5.1].

To enable extensions, verify that they are enabled in your .ini files:
- /etc/php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

所以我尝试使用 php文档安装PHP扩展并且出现此错误:

So I tried to install the extension for php using the php doc and I get this error :

pear/install/mongodb/php_phongo.c  -fno-common -DPIC -o .libs/php_phongo.o
/private/tmp/pear/install/mongodb/php_phongo.c:22:10: fatal error: 'php.h' file not found
#include <php.h>
          ^~~~~~~
1 error generated.
make: *** [php_phongo.lo] Error 1
ERROR: `make' failed

有帮助吗?

推荐答案

升级到MacOS Catalina后,我也遇到了同样的问题

I also had the same issue after upgrading to MacOS Catalina

运行这两个命令;

  1. 酿酒医生
  2. 酿造链接-覆盖php

这篇关于在 mac os 10.15 上为 php7 安装 mongodb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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