How to add `phpseclib/mcrypt_compat` to Magento 1 (for PHP 7.2)?

php72
mcrypt
php

(Dmitry Fedyuk) #1

Step 1

Go to the Magento root folder and execute:

composer require phpseclib/mcrypt_compat

Step 2

Locate the line:

Add the following code below:

if (!extension_loaded('mcrypt')) {
	require_once MAGENTO_ROOT . '/vendor/autoload.php';
}

How to install `mcrypt` for PHP 7.2?
(Poman31) #2

Also make sure to the the same lines to api.php directly below the other requires, like so. Otherwise calls to the magento api will throw a mcrypt error.

require $bootstrapFilename;
require $mageFilename;

if (!extension_loaded('mcrypt')) {
    require_once $magentoRootDir . '/vendor/autoload.php';
}