I'm trying to install mcrypt under php and can't. If I do php test.php | grep mcrypt (where test.php contains phpinfo()) nothing comes up so I want to install it.

If I do sudo apt-get install php5-mcrypt I get this:

E: Unable to locate package php5-mcrypt

If I do sudo apt-cache search mcrypt nothing comes up.

Here's my /etc/apt/sources.list

deb cdrom:[Ubuntu 13.04 _Raring Ringtail_ - Release amd64 (20130424)]/ raring main restricted
deb http://archive.ubuntu.com/ubuntu raring main restricted
deb-src http://archive.ubuntu.com/ubuntu raring main restricted

deb http://security.ubuntu.com/ubuntu raring-security main restricted
deb-src http://security.ubuntu.com/ubuntu raring-security main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu raring-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu raring-updates main restricted

## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
 deb http://archive.ubuntu.com/ubuntu raring universe
 deb-src http://archive.ubuntu.com/ubuntu raring universe
 deb http://archive.ubuntu.com/ubuntu raring-updates universe
 deb-src http://archive.ubuntu.com/ubuntu raring-updates universe
 deb http://security.ubuntu.com/ubuntu raring-security universe
 deb-src http://security.ubuntu.com/ubuntu raring-security universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
 deb http://archive.ubuntu.com/ubuntu raring multiverse
 deb-src http://archive.ubuntu.com/ubuntu raring multiverse
 deb http://archive.ubuntu.com/ubuntu raring-updates multiverse
 deb-src http://archive.ubuntu.com/ubuntu raring-updates multiverse
 deb http://security.ubuntu.com/ubuntu raring-security multiverse
 deb-src http://security.ubuntu.com/ubuntu raring-security multiverse

deb http://us.archive.ubuntu.com/ubuntu/ quantal universe
deb-src http://us.archive.ubuntu.com/ubuntu/ quantal universe
deb http://us.archive.ubuntu.com/ubuntu/ quantal-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ quantal-updates universe

The last set of deb / deb-src stuff is from http://forums.linuxmint.com/viewtopic.php?f=90&t=135896

According to https://stackoverflow.com/q/19446679/569976 this should work:

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt

Only problem: I do not have /etc/php5/conf.d/mcrypt.ini.

Any ideas? Do I have to compile mcrypt myself from source to get it working on ubuntu? I'm running Ubuntu 13.04.


  • Can you try adding deb http://us.archive.ubuntu.com/ubuntu universe in sources.list, then apt-get update and apt-get install php5-mcrypt – krisFR Dec 24 '13 at 16:44
  • """If I do php test.php | grep mcrypt""" -> nothing about the question but try php -i – user130370 Dec 24 '13 at 20:40
  • @user2196728 - it says that line is malformed. I tried deb http://us.archive.ubuntu.com/ubuntu test universe but am still getting the same error. – neubert Dec 25 '13 at 1:02

I'm not sure if you are having the same issue that I am (I'm running Ubuntu 13.10, and not 13.04), but this worked for myself. Here is the original answer: https://stackoverflow.com/questions/19446679/mcrypt-not-present-after-ubuntu-upgrade-to-13-10

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt
sudo service apache2 restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.