jenssegers/laravel-mongodb installation PHP7.1 on cloud9 未解決

*エラーでworkspaceにアクセスできなくなることがあるのでworkspaceをクローンして実行

mongodbのsetup

  • $ sudo pecl install mongodb
→ error
Warning: Invalid argument supplied for foreach() in Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249
solution:

sudo apt-get install php-pear

sudo apt-get install pkg-config

sudo apt-get install libbson-1.0

sudo apt-get install libmongoc-1.0-0


sudo apt-get install php7.1-xml

Add the following line to your php.ini file:

extension=mongodb.so

 

参考:

askubuntu.com

www.digitalocean.com

  • $ sudo pecl install mongodb
  • composer require jenssegers/mongodb
→ error:
  Problem 1
    - jenssegers/mongodb v3.0.0 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1, 1.0.2].
    - jenssegers/mongodb v3.0.1 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1, 1.0.2].
    - jenssegers/mongodb v3.0.2 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1, 1.0.2].
    - mongodb/mongodb 1.0.2 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
    - mongodb/mongodb 1.0.1 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
    - mongodb/mongodb 1.0.0 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
    - Installation request for jenssegers/mongodb ^3.0 -> satisfiable by jenssegers/mongodb[v3.0.0, v3.0.1, v3.0.2].

  To enable extensions, verify that they are enabled in those .ini files:
    - /etc/php5/cli/php.ini
    - /etc/php5/cli/conf.d/05-opcache.ini
    - /etc/php5/cli/conf.d/10-mysqlnd.ini
    - /etc/php5/cli/conf.d/10-pdo.ini
    - /etc/php5/cli/conf.d/20-curl.ini
    - /etc/php5/cli/conf.d/20-gd.ini
    - /etc/php5/cli/conf.d/20-json.ini
    - /etc/php5/cli/conf.d/20-mcrypt.ini
    - /etc/php5/cli/conf.d/20-mongo.ini
    - /etc/php5/cli/conf.d/20-mysql.ini
    - /etc/php5/cli/conf.d/20-mysqli.ini
    - /etc/php5/cli/conf.d/20-pdo_mysql.ini
    - /etc/php5/cli/conf.d/20-pdo_pgsql.ini
    - /etc/php5/cli/conf.d/20-pgsql.ini
    - /etc/php5/cli/conf.d/20-readline.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
solution: sudo apt-get install php-mongodb
参考:

github.com

 
  • composer require jenssegers/mongodb
succesfully installed!
composer.jsonに記載されてもcodeがインストールされない(未解決)

cloud9に特有のmongoDBのインストール
sudo apt-get install -y mongodb-org
$ mkdir data
$ echo
'mongod --bind_ip=$IP --dbpath=data --nojournal --rest "$@"' > mongod
$ chmod a+x mongod

$ ./mongod
→ インストール、起動できたもののcloud9のワークスペースにアクセス出来なくなるエラーが発生(原因不明)。
参考:

community.c9.io