gpt4 book ai didi

mongodb - 在 mac os 10.15 for php7 上安装 mongodb

转载 作者:行者123 更新时间:2023-12-04 15:38:54 24 4
gpt4 key购买 nike

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

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.

所以我尝试使用 the php doc 安装 php 扩展我得到这个错误:

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 后我也遇到了同样的问题

运行这两个命令;

  1. 酿酒博士
  2. brew link --overwrite php

关于mongodb - 在 mac os 10.15 for php7 上安装 mongodb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58737204/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com