MongoDB PHP扩展安装给出配置错误


mongodb php extension install giving configuration error

所以我正在尝试使用 sudo pecl install mongodb 安装 mongodb pecl 扩展并得到以下内容:

downloading mongodb-1.1.2.tgz ...
Starting to download mongodb-1.1.2.tgz (642,582 bytes)
....done: 642,582 bytes
349 source files, building
running: phpize
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012
building in /var/tmp/pear-build-rootGfSZhI/mongodb-1.1.2
running: /var/tmp/mongodb/configure --with-php-config=/usr/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib64/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking whether to enable mongodb support... yes, shared
checking OpenSSL dir for mongodb... yes
checking PHP version... 70000
checking whether to enable developer build flags... no
checking whether to enable code coverage... no
checking whether to use system libbson... no
checking configuring libmongoc... ...
checking whether to use system libmongoc... no
checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's <evp.h>
ERROR: `/var/tmp/mongodb/configure --with-php-config=/usr/bin/php-config' failed

任何想法为什么这不起作用?

Centos,先运行:yum install openssl-devel

这个:

配置: 错误: 找不到 OpenSSL 的 [evp.h]

您需要安装包含该标头的OpenSSL开发包(以及其他内容)。

如果dpkg可用,则可用于确定任何给定文件的提供程序:

$ dpkg -S evp.h
libssl-dev:amd64: /usr/include/openssl/evp.h

这样安装libssl-dev包就可以解决当前的问题。

您可能缺少其他类似的开发包,因此dpkg -S了解这一点很有用。

许多包管理器具有类似的功能,例如yum provides

一般来说,如果缺少某些标头或库,您可以使用后缀-dev(如果这是发行版的约定,则-devel)猜测需要安装的软件包的名称。

您需要做的就是

sudo apt-get install pkg-config

然后尝试再次安装驱动程序。

sudo pecl install mongodb