//Problem Solving: Magento PHP Extension “Mcrypt” Must Be Loaded
magento-php-extension-mcrypt-01

Problem Solving: Magento PHP Extension “Mcrypt” Must Be Loaded

Have you ever seen this: “Magento PHP extension “Mcrypt” must be loaded”?

If so, don’t overlook this helpful article.

As you may know, Magento is a popular open-source platform for almost ecommerce businesses nowadays. And to create extensions, Magento needs to use PHP coding.

However, sometimes, using PHP will run into difficulties as errors may happen, specifically, “Mcrypt” errors.

Understanding such problems, we decided to provide this article to you.

This article will help you understand the functions of PHP Mcrypt. Also, Mcrypt errors will be identified. Then, we will provide methods to fix things quickly.

“Magento PHP Extension “Mcrypt” Must Be Loaded” Errors

magento-php-extension-mcrypt-must-be-loaded

>>> Also read: All Magento 2 Extension Reviews to leverage your business in 2020!

Magento users mainly have problems when trying to install the software. Unless those errors are solved immediately, you will have nothing to run your ecommerce businesses.

However, don’t worry as you have us!

This section will clarify several specific cases that the actual Magento users have come across. And who knows you may have the same problems, right?

So let’s get started!

1.1. Installing Magento 1.9.3

installing-Magento-1.9.3

In this first case, one Magento users ran into “PHP extension Mcrypt must be loaded” while trying to install Magento 1.9.3.

After writing all the necessary code to check on both versions, Mcrypt is still in the list of running extensions. The point is how to make it past that installation screen.

1.2. Installing Magento on Ubuntu 

installing-magento-on-ubuntu

This is another case of installing Magento. This Magento user continuously met obstacles even though he had tried other ways, but it still didn’t work.

Moreover, he also had the same problem with curl. Therefore, he was struggling with difficulties.

Let us know whether you have such problems or not!

1.3. Missing PHP extension (intl, Mcrypt): Magento 2.x on Mac OS

missing-php-extension-on-mac-os

With an independent operating system of IOS, Mac OS is usually more complicated to use and to fix things. For this reason, we found you a specific case for Mac users. You can read the description of the problems above to find out.

Later on, we will explain how to deal with such problems.

PHP Extension Mcrypt Functions

mcrypt_php_functions

It is quite common when Magento users come across such kinds of Mcrypt-related problems.

However, do you exactly know what PHP Mcrypt is? Why must Magento PHP extension “Mcrypt” be loaded when installing Magento?

Before doing anything, you need to answer all those questions. And we’re here to help you. Please stay tuned with us!

What Is Mcrypt?

The Mcrypt extension replaces the use of UNIX crypt command. It enables developers to use a wide range of encryption functions, without having to change their code significantly.

Moreover, while UNIX crypt commands serve as a means to encrypt files on UNIX and Linux systems, the PHP-Mcrypt extension acts as an interface between PHP and Mcrypt.

What Are Mcrypt Functions?

Mcrypt has a list of enormous functions that helpful for your Magento software. The highlight function is to encrypt and decrypt data using Mcrypt ciphers. To start using the software, this is indispensable. 

Besides, there are a huge number of other functions. To name but a few:

  • Encrypts/decrypts data in CBC/CFB/OFB mode
  • Creates an initialization vector (IV) from a random source
  • Encrypts/Decrypts crypt text with given parameters
  • Returns the name/blocksize/the size of IV/an array with the supported key sizes of the opened algorithm
  • Returns the maximum supported key size/name of the opened mode
  • Runs a self-test on the opened module
  • Initializes all buffers needed for encryption
  • Opens the module of the algorithm and the mode to be used
  • Terminates encryption

How to Fix “Magento PHP Extension “Mcrypt” Must Be Loaded” Error?

how-to-fix

So now, you all know the PHP Mcrypt functions. Let’s go back to all the errors we have identified!

You may wonder how to fix such faults. Then, this part is essential to you. We have collected all the actual methods for you. Let’s get started!

1.1. Installing Magento 1.9.3

This problem has been posted for advice on Magento StackExchange. And several problem-dealing ways have been given out.

  • Method 1: Restart the web server and execute the following command to run the php file and check whether there is Mcrypt extension or not:
<?php
phpinfo();
  • Method 2: If you have access to SSH for your server, please install php5-mcrypt with:
sudo apt-get install php5-mcrypt

or

yum install php5-mcrypt
  • Method 3: You can try to run this command:
sudo apt-get install php5.6-mcrypt

sudo service apache2 graceful

1.2. Installing Magento on Ubuntu

On Stackoverflow, there are several advices, and it did work to fix things. However, this method below was considered to be helpful by most users with the same problem.

It’s relatively simple. You have to execute this command, and everything will be solved:

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

sudo php5enmod mcrypt

sudo service apache2 restart

1.3. Missing PHP Extension (intl, Mcrypt): Magento 2.x on Mac OS

We supposed that to fix this error on Mac OS is relatively complicated. Surprisingly, the solution is simple.

Several pieces of advices have been given on Magento Forum. Some of them did work, which we will show you right now.

The reason for that problem is that the files were not in the directory path for apache to recognize in php.ini. The path should be like this:

cat /usr/local/etc/php/5.6/conf.d/ext-mcrypt.ini >> /etc/php.ini

cat /usr/local/etc/php/5.6/conf.d/ext-intl.ini >> /etc/php.ini

Then, you can execute this command below to update to etc/php.ini:

[mcrypt]

extension="/usr/local/opt/php56-mcrypt/mcrypt.so"
[intl]

extension="/usr/local/opt/php56-intl/intl.so"

Conclusion

When it comes to installing and setting up software, problems always happen. Therefore, we need to react quickly; otherwise, we have nothing to run businesses.

Above are several “Magento PHP Extension “Mcrypt” Must Be Loaded” problems that we have found out from the actual users. Along with which are some solutions in reality that may help to fix things.

We hope that this article is helpful to you. If you still have problems related to this or these solutions don’t work, please feel free to contact us. It’s our pleasure to help you.

Thanks a lot for reading!