PHP 7.0.6 // MongoDB驱动程序 - CLI工作;网络没有

时间:2016-05-19 15:21:14

标签: php mongodb driver php-7 apache2.4

我的新PHP 7安装加载并在命令行中使用mongodb驱动程序。

但是当我尝试查看与网页相同的资源时,驱动程序无法加载(并且我得到了伴随该失败的随之而来的错误,pe:Class' MongoDB \ Driver \ Query& #39;未找到")。

不知道为什么Apache,php和mongodb驱动程序不能一起工作。这是deets:

我正在运行Apache 2.4.18 ...

httpd -v

Server version: Apache/2.4.18 (Amazon)
Server built:   Mar  7 2016 22:32:11

和PHP 7.0.6(remi repo)......

PHP cli

PHP 7.0.6 (cli) (built: Apr 28 2016 21:34:10) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans

phpinfo()确认:版本,php.ini位置和extension_dir是我期望找到它们的地方......

的phpinfo()

PHP Version 7.0.6
Loaded Configuration File /etc/opt/remi/php70/php.ini
extension_dir /opt/remi/php70/root/usr/lib64/php/modules

我已将扩展程序添加到已加载的ini文件...

/etc/opt/remi/php70/php.ini

[mongo]
extension=mongodb.so

我已经确认该扩展程序的lib是php期望的...

ls -la /opt/remi/php70/root/usr/lib64/php/modules/mongodb.so

[redacted] /opt/remi/php70/root/usr/lib64/php/modules/mongodb.so

pecl说PEAR是最新的...

pecl帮助版

PEAR Version: 1.10.1
PHP Version: 7.0.6
Zend Engine Version: 3.0.0

yum install php70-php-pecl-mongodb

Loaded plugins: update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package php70-php-pecl-mongodb.x86_64 0:1.1.6-2.el7.remi will be installed
--> Processing Dependency: mongo-c-driver(x86-64) >= 1.3.5 for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Processing Dependency: libbson-1.0.so.0(LIBBSON_1.2)(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Processing Dependency: libbson-1.0.so.0(LIBBSON_1.1)(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Processing Dependency: libbson-1.0.so.0(LIBBSON_1.0)(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Processing Dependency: libsasl2.so.3()(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Processing Dependency: libmongoc-priv.so.0()(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Processing Dependency: libbson-1.0.so.0()(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Running transaction check
---> Package mongo-c-driver.x86_64 0:1.3.5-1.el7.remi will be installed
--> Processing Dependency: mongo-c-driver-libs(x86-64) = 1.3.5-1.el7.remi for package: mongo-c-driver-1.3.5-1.el7.remi.x86_64
--> Processing Dependency: libbson-1.0.so.0()(64bit) for package: mongo-c-driver-1.3.5-1.el7.remi.x86_64
---> Package php70-php-pecl-mongodb.x86_64 0:1.1.6-2.el7.remi will be installed
--> Processing Dependency: libbson-1.0.so.0(LIBBSON_1.2)(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Processing Dependency: libbson-1.0.so.0(LIBBSON_1.1)(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Processing Dependency: libbson-1.0.so.0(LIBBSON_1.0)(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Processing Dependency: libsasl2.so.3()(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Processing Dependency: libmongoc-priv.so.0()(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Processing Dependency: libbson-1.0.so.0()(64bit) for package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64
--> Finished Dependency Resolution
Error: Package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64 (remi-safe)
           Requires: libbson-1.0.so.0(LIBBSON_1.2)(64bit)
Error: Package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64 (remi-safe)
           Requires: libsasl2.so.3()(64bit)
Error: Package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64 (remi-safe)
           Requires: libbson-1.0.so.0()(64bit)
Error: Package: mongo-c-driver-1.3.5-1.el7.remi.x86_64 (remi-safe)
           Requires: libbson-1.0.so.0()(64bit)
Error: Package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64 (remi-safe)
           Requires: libmongoc-priv.so.0()(64bit)
Error: Package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64 (remi-safe)
           Requires: libbson-1.0.so.0(LIBBSON_1.0)(64bit)
Error: Package: mongo-c-driver-1.3.5-1.el7.remi.x86_64 (remi-safe)
           Requires: mongo-c-driver-libs(x86-64) = 1.3.5-1.el7.remi
Error: Package: php70-php-pecl-mongodb-1.1.6-2.el7.remi.x86_64 (remi-safe)
           Requires: libbson-1.0.so.0(LIBBSON_1.1)(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

rpm -qa php * |排序

php70-1.0-4.el6.remi.x86_64
php70-php-cli-7.0.6-3.el6.remi.x86_64
php70-php-common-7.0.6-3.el6.remi.x86_64
php70-php-devel-7.0.6-3.el6.remi.x86_64
php70-php-fpm-7.0.6-3.el6.remi.x86_64
php70-php-gd-7.0.6-3.el6.remi.x86_64
php70-php-json-7.0.6-3.el6.remi.x86_64
php70-php-mbstring-7.0.6-3.el6.remi.x86_64
php70-php-mcrypt-7.0.6-3.el6.remi.x86_64
php70-php-mysqlnd-7.0.6-3.el6.remi.x86_64
php70-php-opcache-7.0.6-3.el6.remi.x86_64
php70-php-pdo-7.0.6-3.el6.remi.x86_64
php70-php-pear-1.10.1-4.el6.remi.noarch
php70-php-pecl-amqp-1.7.0-1.el6.remi.x86_64
php70-php-pecl-apcu-5.1.4-1.el6.remi.x86_64
php70-php-pecl-apcu-bc-1.0.3-1.el6.remi.x86_64
php70-php-pecl-apcu-devel-5.1.4-1.el6.remi.x86_64
php70-php-pecl-apfd-1.0.1-5.el6.remi.x86_64
php70-php-pecl-apm-2.1.1-1.el6.remi.x86_64
php70-php-pecl-bitset-3.0.0-1.el6.remi.x86_64
php70-php-pecl-cassandra-1.1.0-1.el6.remi.x86_64
php70-php-pecl-couchbase2-2.2.0-0.1.beta2.el6.remi.x86_64
php70-php-pecl-crypto-0.2.2-1.el6.remi.x86_64
php70-php-pecl-eio-2.0.0-0.4.RC3.el6.remi.x86_64
php70-php-pecl-env-0.2.1-1.el6.remi.x86_64
php70-php-pecl-ev-1.0.0-1.el6.remi.x86_64
php70-php-pecl-event-2.0.4-1.el6.remi.x86_64
php70-php-pecl-fann-1.1.0-1.el6.remi.x86_64
php70-php-pecl-gender-1.1.0-6.el6.remi.x86_64
php70-php-pecl-geoip-1.1.0-9.el6.remi.x86_64
php70-php-pecl-geospatial-0.1.0-1.el6.remi.x86_64
php70-php-pecl-hprose-1.6.4-1.el6.remi.x86_64
php70-php-pecl-hrtime-0.5.1-6.el6.remi.x86_64
php70-php-pecl-http-3.0.1-1.el6.remi.x86_64
php70-php-pecl-http-devel-3.0.1-1.el6.remi.x86_64
php70-php-pecl-igbinary-1.2.2-0.1.20151217git2b7c703.el6.remi.x86_64
php70-php-pecl-igbinary-devel-1.2.2-0.1.20151217git2b7c703.el6.remi.x86_64
php70-php-pecl-inotify-2.0.0-1.el6.remi.x86_64
php70-php-pecl-json-post-1.0.1-3.el6.remi.x86_64
php70-php-pecl-libsodium-1.0.6-1.el6.remi.x86_64
php70-php-pecl-lua-2.0.1-1.el6.remi.x86_64
php70-php-pecl-lzf-1.6.5-1.el6.remi.x86_64
php70-php-pecl-mailparse-3.0.1-1.el6.remi.x86_64
php70-php-pecl-memcache-3.0.9-0.2.20151130gitfdbd46b.el6.remi.x86_64
php70-php-pecl-memcached-3.0.0-0.1.20160217git6ace07d.el6.remi.x86_64
php70-php-pecl-mogilefs-0.9.3.1-1.el6.remi.x86_64
php70-php-pecl-msgpack-2.0.1-1.el6.remi.x86_64
php70-php-pecl-msgpack-devel-2.0.1-1.el6.remi.x86_64
php70-php-pecl-mysql-1.0.0-0.9.20151007git294ce3b.el6.remi.x86_64
php70-php-pecl-oauth-2.0.1-1.el6.remi.x86_64
php70-php-pecl-pcs-1.3.1-1.el6.remi.x86_64
php70-php-pecl-pcs-devel-1.3.1-1.el6.remi.x86_64
php70-php-pecl-propro-2.0.0-1.el6.remi.x86_64
php70-php-pecl-propro-devel-2.0.0-1.el6.remi.x86_64
php70-php-pecl-radius-1.4.0-0.1.b1.el6.remi.x86_64
php70-php-pecl-raphf-2.0.0-1.el6.remi.x86_64
php70-php-pecl-raphf-devel-2.0.0-1.el6.remi.x86_64
php70-php-pecl-redis-2.2.8-0.6.20160504gitad3c116.el6.remi.x86_64
php70-php-pecl-rrd-2.0.1-1.el6.remi.x86_64
php70-php-pecl-scrypt-1.4-1.el6.remi.x86_64
php70-php-pecl-seaslog-1.5.3-1.el6.remi.x86_64
php70-php-pecl-selinux-0.4.1-6.el6.remi.x86_64
php70-php-pecl-solr2-2.4.0-1.el6.remi.x86_64
php70-php-pecl-ssdeep-1.0.4-9.el6.remi.x86_64
php70-php-pecl-stats-2.0.1-1.el6.remi.x86_64
php70-php-pecl-swoole-1.8.5-1.el6.remi.x86_64
php70-php-pecl-taint-2.0.1-1.el6.remi.x86_64
php70-php-pecl-trader-0.4.0-2.el6.remi.x86_64
php70-php-pecl-uopz-5.0.1-1.el6.remi.x86_64
php70-php-pecl-uploadprogress-1.0.3.1-11.el6.remi.x86_64
php70-php-pecl-uuid-1.0.4-6.el6.remi.x86_64
php70-php-pecl-weakref-0.3.2-1.el6.remi.x86_64
php70-php-pecl-xattr-1.3.0-1.el6.remi.x86_64
php70-php-pecl-xdebug-2.4.0-1.el6.remi.x86_64
php70-php-pecl-xmldiff-1.1.2-6.el6.remi.x86_64
php70-php-pecl-xmldiff-devel-1.1.2-6.el6.remi.x86_64
php70-php-pecl-xxtea-1.0.11-1.el6.remi.x86_64
php70-php-pecl-yac-2.0.0-1.el6.remi.x86_64
php70-php-pecl-yaconf-1.0.1-1.el6.remi.x86_64
php70-php-pecl-yaconf-devel-1.0.1-1.el6.remi.x86_64
php70-php-pecl-yaf-3.0.2-1.el6.remi.x86_64
php70-php-pecl-yaml-2.0.0-0.6.RC7.el6.remi.x86_64
php70-php-pecl-yar-2.0.0-1.el6.remi.x86_64
php70-php-pecl-yaz-1.2.0-2.el6.remi.x86_64
php70-php-pecl-zip-1.13.2-1.el6.remi.x86_64
php70-php-pecl-zmq-1.1.3-1.el6.remi.x86_64
php70-php-process-7.0.6-3.el6.remi.x86_64
php70-php-xml-7.0.6-3.el6.remi.x86_64
php70-runtime-1.0-4.el6.remi.x86_64
php-cli-7.0.6-3.el6.remi.x86_64
php-common-7.0.6-3.el6.remi.x86_64
php-devel-7.0.6-3.el6.remi.x86_64
php-json-7.0.6-3.el6.remi.x86_64
php-pear-1.10.1-4.el6.remi.noarch
php-process-7.0.6-3.el6.remi.x86_64
php-xml-7.0.6-3.el6.remi.x86_64

1 个答案:

答案 0 :(得分:0)

你是如何安装mongodb扩展的?

您不必编辑php.ini。

php70-php-pecl-mongodb RPM提供了配置文件/etc/opt/remi/php70/php.d/50-mongodb.ini。

“php70 -v”和“php70 -m”的输出是什么?