113

The php mcrypt extension on ubuntu 14.04 shows that it is installed properly, but phpmyadmin says:

 The mcrypt extension is missing. Please check your PHP configuration.

My current php config is here. If you need anymore information, please contact me through the comments.

$ sudo apt-get install php5-mcrypt
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    php5-mcrypt is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

14 Answers14

155

Try just doing this:

sudo php5enmod mcrypt

And then:

sudo service apache2 restart 

I have installed fresh Ubuntu 14.04 (desktop version) to my computer. This way works for enabling mcrypt that was already installed.

Eliah Kagan
  • 119,640
MURATSPLAT
  • 1,801
  • 1
  • 11
  • 6
139

Try this:

sudo updatedb 
locate mcrypt.ini

Should show it located at /etc/php5/mods-available

locate mcrypt.so

Edit mcrypt.ini and change extension to match the path to mcrypt.so, example:

extension=/usr/lib/php5/20121212/mcrypt.so

Now this:

sudo php5enmod mcrypt - (optional since its already enabled during phpmyadmin setup)

Verify that new files exists here (they should be auto created from the issue above)

ls -al /etc/php5/cli/conf.d/20-mcrypt.ini
ls -al /etc/php5/apache2/conf.d/20-mcrypt.ini

Otherwise do the following

Create symbol links now

sudo ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini
sudo ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini

Restart Apache

sudo service apache2 restart

Restart php5 or php5-fpm

sudo service php5 restart
atilkan
  • 260
Kevsin
  • 1,530
55

Install mcrypt extension for PHP, Enable it, and Restart Apache. Following are the commands to do:

sudo apt-get install mcrypt php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart
d a i s y
  • 5,551
thucnguyen
  • 1,519
6

The php5-mcrypt Ubuntu package install the config file mcrypt.ini into /etc/php5/conf.d/ which is the old PHP config directory layout.

The current way of working to enable modules in PHP5 is to put the ini files in the /etc/php5/mods-available directory. Then, to enable the module in PHP5, you have to create a symbolic link to the related ini files from /etc/php5/apache2/conf.d directory to enable the module when PHP is used under Apache or / and from /etc/php5/cli/conf.d if you want to have this module enabled when you use PHP outside Apache, in scripts run at the command line or from crontab.

Also note that in the conf.d directory, you can create the link to the ini file by putting a number in front of it to have the modules loaded in a specific order. Usefull when you need to load a module depending on another one.

Of course, don't forget to restart Apache if you have enabled the module for Apache :

 sudo service apache2 restart
Benoit
  • 7,637
4

My 14.04 server install only needed (after php5-mcrypt installed)

sudo php5enmod mcrypt
sudo service apache2 restart
John
  • 111
3

If the Problem still occurs,

enable the module by adding: extension=mcrypt.so to

/etc/php5/cli/php.ini

and

/etc/php5/apache2/php.ini

2

In Ubuntu 16.04 LTS, to enable the mcrypt module, with php 5.6:

sudo apt-get install mcrypt
sudo apt-get install php5.6-mcrypt
sudo phpenmod mcrypt

or with php 7.0:

sudo apt-get install mcrypt
sudo apt-get install php7.0-mcrypt
sudo phpenmod mcrypt

and then

sudo service apache2 restart
1

With PHP 7

sudo apt-get install php-mcrypt
sudo phpenmod mcrypt
sudo /etc/init.d/apache2 restart
madeye
  • 111
0

You should be able to install the mcrypt extension for PHP by running:

sudo apt-get install php5-mcrypt
jkt123
  • 3,600
0

Note that in Ubuntu 14.04 the php5-mcrypt is in the universe repository that could be disabled. In this case to install it you must enable the repository with:

sudo add-apt-repository universe
salgua
  • 101
0

You need to enable the mcrypt module:

sudo php5enmod mcrypt
sudo service apache2 restart
dr_
  • 837
0

This is the best way to add php 5.5 mcrypt extension on Ubuntu 14.04 Server

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

@Kevsin's answer worked for me, but I had to run mkdir -p /etc/php5/apache2/conf.d/ and manually run the sudo ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini to get to work. sudo php5enmod mcrypt worked fine for the first symlink.

Note: I'm running PHP5-FPM. That may have been the difference.

0

For those who find this, for Ubuntu 16.04 (using PHP7), here is what I did to enable mcrypt:

sudo apt-get install mcrypt php-mcrypt
sudo phpenmod mcrypt
sudo service apache2 restart
Richard
  • 111