6

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

2

1 Answer 1

8

I had this problem as well when using 7.1 and after upgrading pecl through apt-get. I solved this by installing the php7.1-xml package using apt-get.

If you're running 7.0, then you need to do the following:

sudo apt-get install php7.0-xml

If you're running 7.1, then run this:

sudo apt-get install php7.1-xml

That should solve your issue. It seems that PEAR parses help text and config info at startup and (I'm assuming) it's stored as XML somewhere

2
  • 1
    Fixes the problem also on Ubuntu 16 with php7.2, thanks. Jul 31, 2017 at 14:49
  • In the case you are using php 7.3 run sudo apt-get install php7.3-xml
    – jjoselon
    Jan 9, 2019 at 1:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .