Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php extension mcrypt must be loaded

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.

like image 282
Loko Avatar asked Sep 30 '14 08:09

Loko


People also ask

How do I enable mcrypt extension?

You can install Mcrypt from the PHP Source Tree as a module if you choose. Enable the module by adding: 'extension=mcrypt.so' to PHP. ini. Done!

What is mcrypt PHP extension required?

The mcrypt extension is an interface to the mcrypt cryptography library. This extension is useful for allowing PHP code using mcrypt to run on PHP 7.2+. The mcrypt extension is included in PHP 5.4 through PHP 7.1.

How do I know if mcrypt is enabled?

You can also achieve this same screen by viewing a php file that has: phpinfo(); somewhere in the code. In this screen, simply search for the string "mcrypt support". If installed, you will see a box that says "enabled".

What does PHP mcrypt do?

Overview. The mcrypt PHP module provides an interface to the mcrypt library and supports encryption. The cPanel-provided EasyApache 4 profiles include the mcrypt PHP module by default.


2 Answers

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
like image 81
Tapaswi Panda Avatar answered Sep 28 '22 06:09

Tapaswi Panda


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.

like image 42
Coffee123 Avatar answered Sep 28 '22 06:09

Coffee123