0

"E: Package 'php-mcrypt' has no installation candidate" error on Ubuntu 20.4.1

I am getting below error when try to install php modules on Ubuntu20.4.1

Ubuntu Php Error-handling Add a comment
mason
asked Mar 15 2021
edited Mar 15 2021

Answer

0

To fix above error follow the below steps

You’ll need to first install PHP, dev and pear extensions on Ubuntu 20.04 by using following command.
sudo apt install php php-pear php-dev libmcrypt-dev
Confirm pecl command is available in your system.
which pecl
You can the install mcrypt extension using pecl command with install option.
sudo pecl install mcrypt
You should get an output like below for completed installation of mcrypt extension on Ubuntu 20.04 Linux machine.
Build process completed successfully

Installing '/usr/lib/php/20190902/mcrypt.so'
install ok: channel://pecl.php.net/mcrypt-1.0.3

configuration option "php_ini" is not set to php.ini location
You should add "extension=mcrypt.so" to php.ini
Enable extension in php.ini file.

sudo vim /etc/php/7.4/cli/php.ini
extension=mcrypt.so
sudo vim /etc/php/7.4/apache2/php.ini
extension=mcrypt.so

You can confirm that the module was installed and enabled with the command:

php -m | grep mcrypt
mcrypt
Add a comment
linuxhelp
asked Mar 15 2021
Post your Answer