4

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: 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

1

Your need to install this extensions

sudo apt-get install php-pear
sudo apt-get install php-xml php7.0-xml
sudo pecl install mongodb
0

In my case on Ubuntu there was php7.1 (fpm) AND php7.2 (cli) installed.

Switching the cli explicitly to php7.1 using

sudo update-alternatives --set php /usr/bin/php7.1
sudo update-alternatives --set phpize /usr/bin/phpize7.1
sudo update-alternatives --set php-config /usr/bin/php-config7.1

fixes the problem for me.

-3

Install php-xml with apt-get:

 sudo apt-get install php-xml php7.0-xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.