I’ve upgraded php to version 7 and now I have problems with pecl command. When I run sudo pecl install mongo I get long list of errors:
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
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
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
I’ve tried solutions from this question: https://serverfault.com/questions/589877/pecl-command-produces-long-list-of-errors but it’s not working. I’m using Ubuntu 14.04 with PHP7, I installed php-dev package
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
i have this problem too i have php 5.6 and some php 7.1 lib on ubonto 16 so after a lot of search i found that i need to install this list --> and after its works!!
so i installed
apt-get install php-pear
apt-get install pkg-config
apt-get install libbson-1.0
apt-get install libmongoc-1.0-0
apt-get install php-xml php7.0-xml
apt-get install php-dev
then Add the following line to your php.ini file:
some more information for php 7.1 you must use the “mongodb” extension for php 5.6 you need to use “mongo” (dont sure if it must - but i didnt success to use mongodb in php 5.6 )
so for php 5.6 use “apt-get php5.6-mongo”
Hey there,
It looks like the ‘mongo’ package has been depreciated with PHP 7. You might have better luck with the following:
pecl install mongodb
For more information you should take a look at the following resources:
https://docs.mongodb.org/ecosystem/drivers/php/ http://stackoverflow.com/questions/34486808/installing-the-php-7-mongodb-client-driver
Regards, Mike C Platform Support Specialist DigitalOcean Support
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
