php-mcrypt package missing in Ubuntu Server 18.04 LTS
Is the php-mcrypt package missing in Ubuntu Server 18.04 LTS?
apt install php-mcrypt
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php-mcrypt is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php-mcrypt' has no installation candidate 1 4 Answers
Mcrypt has been deprecated in PHP 7.2, so it's not available by default.
You can still install the mcrypt extension using pecl. These instructions are for the apache web server.
# Install prerequisites
sudo apt-get install php-dev libmcrypt-dev gcc make autoconf libc-dev pkg-config
# Compile mcrypt extension
sudo pecl install mcrypt-1.0.1
# Just press enter when it asks about libmcrypt prefix
# Enable extension for apache
echo "extension=mcrypt.so" | sudo tee -a /etc/php/7.2/apache2/conf.d/mcrypt.ini
# Restart apache
sudo service apache2 restartThat should get you going.
In the long term you might want to replace mcrypt, it's deprecated for a reason.
I did the following to get this working...
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php7.1-mcryptIf you're running php5.6 or 7.0 then you can use the following
sudo apt-get install php5.6-mcrypt
sudo apt-get install php7.0-mcrypt 2 First Check whether the mcrypt PHP module is present:
$ php -m | grep mcryptTo install the mcrypt PHP module we first need to satisfy the following prerequisites:
sudo apt install php-dev libmcrypt-dev php-pearNow we are ready to install mcrypt PHP module on our Ubuntu 18.04 system:
$ sudo pecl channel-update pecl.php.net
$ sudo pecl install mcrypt-1.0.1Open the /etc/php/7.2/cli/php.ini file and insert:
extension=mcrypt.soAll done. When successful, checking for the presence of the mcrypt PHP module should produce the following output:
$ php -m | grep mcrypt
mcrypt php mcrypt has been removed in php 7.2