Home » Php » magento – php extension mcrypt must be loaded

magento – php extension mcrypt must be loaded

Posted by: admin July 12, 2020 Leave a comment


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.

How to&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


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:


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 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:


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


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


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


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


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

UBUNTU: sudo apt-get install php-mcrypt

CENTOS: sudo yum install php-mcrypt