MongoClient php类不存在

时间:2018-04-02 22:13:40

标签: php mongodb docker

我使用docker来运行我的网站。 我用PHP构建了php-fpm容器。

Phpinfo在浏览器中显示此信息:

Additional .ini files parsed    
/usr/local/etc/php/conf.d/docker-php-ext-gd.ini, 
/usr/local/etc/php/conf.d/docker-php-ext-mcrypt.ini, 
/usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini, 
/usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini, 
/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini, 
/usr/local/etc/php/conf.d/docker-php-ext-soap.ini, 
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini, 
/usr/local/etc/php/conf.d/ext-xdebug.ini

enter image description here

但同时class_exists(' MongoClient')返回false

我的docker-compose.yml(不是所有服务):

installer:
  image: andreaskoch/dockerized-magento-installer
  environment:
    DOMAIN: dockerized-magento.local
  volumes_from:
    - nginx
  volumes:
    - ./config/installer/bin/install.sh:/bin/install.sh
  links:
    - "cache:rediscache"
    - "sessions:redissession"
    - "fullpagecache:redisfullpagecache"
    - "solr:solr"
    - "mysql:mysql"
    - "mongodb:mongodb"
  entrypoint: /bin/install.sh
nginx:
  image: nginx:latest
  ports:
    - "80:80"
    - "443:443"
  links:
    - "php"
  volumes:
    - ./logs/nginx:/var/log/nginx
  volumes_from:
    - php
php:
  image: avestique/php7_fpm
  links:
    - "cache:rediscache"
    - "sessions:redissession"
    - "fullpagecache:redisfullpagecache"
    - "solr:solr"
    - "mysql:mysql"
    - "mongodb:mongodb"
  volumes:
    - ./config/installer/php/php.ini:/usr/local/etc/php/php.ini
    - ./config/installer/php/ext-xdebug.ini:/usr/local/etc/php/conf.d/ext-xdebug.ini
    - ./htdocs:/var/www/htdocs
mongodb:
  image: mongo:latest
  environment:
    - MONGO_DATA_DIR=/data/db
    - MONGO_LOG_DIR=/dev/null
  volumes:
    - ./data/mongo:/data/db
  ports:
      - 27017:27017
  command: mongod --smallfiles --logpath=/dev/null

实际上andreaskoch / dockerized-magento-installer有php5.6。但是再次 - phpinfo显示PHP Version 7.0.28Server API FPM/FastCGI,它看起来 avestique / php7_fpm图片。

为什么没有显示MongoClient?

0 个答案:

没有答案