sudo pecl command not found

Fire up a terminal and use:

sudo apt-get update
sudo apt-get install php-pear php5-dev

This is what I did.

I completely remove old packages using

sudo apt-get purge php-pear

Then installed pear using the following command

sudo apt-get install -f php-pear php5-dev

Now it works.

Thanks


The question is old but still valid. Im using php 7.4 with Ubuntu 20.04 but none of the above works for me

instead for php7.4 I executed the following commands at my terminal

sudo apt install php-dev php-pear

then you can run:

sudo pecl install mongodb

credit goes to https://www.php.net/manual/en/mongodb.installation.pecl.php#125027