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