7

I was following a tutorial online about installing magento on ubuntu but I get this error at the config: php extension mcrypt must be loaded. I already tried: sudo apt-get install php5-mcrypt but this didn't work for me. I had the same problem with curl but when I tried: sudo apt-get install php5-curl it did work for me. How do I fix this with mcrypt? I already tried to restart the webserver.

Loko
  • 6,539
  • 14
  • 50
  • 78
  • What does "didn't work" actually mean? Did it try to install and error? did it install but mcrypt isn't visible in PHP? Did it spontaneously combust your server? – Mark Baker Sep 30 '14 at 08:51
  • @MarkBaker Obviously I mean removing the error... – Loko Sep 30 '14 at 08:54
  • It isn't obvious, and still isn't obvious..... what output was displayed when you did `sudo apt-get install php5-mcrypt`? Were any error messages displayed? I certainly can't tell if the installation of mcrypt or curl failed, or if you simply haven't configured PHP correctly to use them – Mark Baker Sep 30 '14 at 09:01
  • Sorry I'm just so stupid that I couldn't understand your question, I really should give up trying to help people – Mark Baker Sep 30 '14 at 09:18
  • @MarkBaker Not saying you're stupid. I'm just saying that I'm not saying it literally but it is obvious. I had guys before on other questions who always critisize(or whatever) people's questions because someone says that they're too vague on the questions when they use: "It doesn't work" and I think most people who do that are smartasses. I can understand it a bit at this question but the other people still knew the answer apparently. – Loko Sep 30 '14 at 12:43

6 Answers6

29

Hope your system is ubuntu as you added the tag.

On Ubuntu when you run sudo apt-get install php5-mcrypt it doesn't actually install the extension into the mods-available. You'll need to symlink it.

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

Then enable the extension and restart Apache.

sudo php5enmod mcrypt
sudo service apache2 reload
Sourabh Kumar Sharma
  • 2,864
  • 3
  • 25
  • 33
Tapaswi Panda
  • 1,041
  • 7
  • 13
  • 2
    I am not sure you need to the symlink step as it is always put in the correct location for me when I call `php5enmod`. Additionally you might get away with a `reload` instead of `restart` on Apache. – Treffynnon Sep 30 '14 at 08:57
  • 2
    @Treffynnon, right, just php5enmod would work here. Yes, we can just reload instead of restart. Edited the same. Thanks... – Tapaswi Panda Sep 30 '14 at 09:07
  • In Ubuntu 14.04 it's enough just to enable the extension and restart apache. See also http://magento.stackexchange.com/q/36954/26260 and http://askubuntu.com/q/380280/18928. – user272735 May 14 '15 at 17:43
  • Only the php5enmod was enough for me. Thanks for saving answer. – Ismael May 31 '15 at 22:04
  • how can be install this for php7 – Shubham AgaRwal Mar 29 '17 at 23:34
1

I am not sure why your PHP.INI is slightly different than mine. Or why I did not need to use PHP5ENMOD.

Here is how I solved the same problem:

1) Make sure it is installed on my distribution, which is not the problem most people are having.

2) Check the PHP configuration to make sure it is loaded (it was not). Here is the code for a PHP configuration info page:

<?php
phpinfo();
?>

Run it in a browser. If MCrypt is enabled (which it is NOT), you will see a whole table dedicated to it with simmilar information (You will see this later):

mcrypt
mcrypt support  enabled
mcrypt_filter support   enabled
Version     2.5.8
Api No  20021217
Supported ciphers   cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
Supported modes     cbc cfb ctr ecb ncfb nofb ofb stream

Directive   Local Value Master Value
mcrypt.algorithms_dir   no value    no value
mcrypt.modes_dir    no value    no value

3) On the same page look for the location of your PHP.INI file. for example:

Configuration File (php.ini) Path   /etc/php5/apache2
Loaded Configuration File   /etc/php5/apache2/php.ini 

My distribution had this file in a different location, but for linux just add or uncomment so you have:

extension=mcrypt.so

Restart your apache server to make sure. You should now check your configuration page and see the MCRYPT is loaded.

Coffee123
  • 156
  • 2
  • 9
0

You should edit php.ini and remove the ; before the line where the extension=php_mcrypt is loaded (you should restart apache thereafter).

Jeroen de Jong
  • 337
  • 1
  • 6
0

Hi just copy this cmd lines and paste in your terminal

sudo apt-get install php5-intl
sudo apt-get install php5-xsl
sudo php5enmod xsl
sudo service apache2 restart
Ashish Pathak
  • 827
  • 8
  • 16
0

In my case, using Nginx and PHP-FPM, once enabled the extention thru this command: sudo php5enmod mcrypt I need to restart php5-fpm using this command: sudo service php5-fpm restart

afsetiawan
  • 1
  • 1
  • 1
0

It depends on the version of the OS you're using.

UBUNTU: sudo apt-get install php-mcrypt

CENTOS: sudo yum install php-mcrypt

Paul Williams
  • 1,554
  • 7
  • 40
  • 75