menu

Questions & Answers

ERROR sudo pecl install mongodb on Linux apache

I'm trying to install mongodb for php 7.4:

sudo pecl install mongodb

But i'm getting this error in the linux console.

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

XML Extension not found

Comments:
2023-01-19 23:01:08
Looks like you may need to install the PHP XML extension.
2023-01-19 23:01:08
Thanks, that worked: sudo apt-get install php7.4-xml, and sudo service apache2 restart
Answers(1) :

The problem was that the xml extension was not enabled.

This worked for me:

sudo apt-get install php7.4-xml

and restart apache:

sudo service apache2 restart