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

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';
}
1 Like

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';
}
2 Likes