Notice: Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH'

Notice: Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH'

October 19, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Notice: Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH'

Solving the “Use of Undefined Constant MCRYPT_BLOWFISH” Error in Magento

As a senior developer working with e-commerce platforms like Magento, we often encounter PHP errors during installation or upgrade processes. One such common issue is the undefined constant notice for MCRYPT_BLOWFISH. Let’s dive into understanding this error and provide a step-by-step guide to resolve it.

Understanding the Error

This error occurs because Magento attempts to use the MCRYPT_BLOWFISH constant, which isn’t defined in your PHP environment. The mcrypt extension was deprecated in PHP 7.1 and removed entirely from PHP 7.2 onwards. However, some older versions of Magento still rely on it for encryption purposes.

Diagnosing the Issue

Given your environment details—macOS High Sierra with PHP 7.1—the issue likely arises due to a misconfiguration or missing dependencies involving the mcrypt extension.

You’ve already attempted to resolve this by adding the extension=mcrypt.so line in the php.ini file and installing the php71-mcrypt package via Homebrew. This approach should have enabled the mcrypt extension if properly configured. Let’s troubleshoot further.

Step-by-Step Resolution

1. Verify mcrypt Extension Status

First, confirm whether the mcrypt extension is actually enabled in your PHP configuration:

php -m | grep mcrypt

If the output includes mcrypt, the extension is loaded correctly. If not, proceed to the next steps.

2. Check PHP Configuration File

Ensure that you’ve edited the correct php.ini file for your CLI environment. The default location is usually:

/usr/local/php71/lib/php.ini

Double-check that the extension=mcrypt.so line exists and is uncommented (not prefixed with a semi-colon).

3. Test mcrypt Extension

Create a simple PHP script to test if the mcrypt extension works:

<?php
if (extension_loaded('mcrypt')) {
    echo 'mcrypt extension is loaded';
} else {
    echo 'mcrypt extension is not loaded';
}

Run this file using your PHP CLI. If it outputs “mcrypt extension is loaded”, proceed to the next step. Otherwise, there might be an issue with the mcrypt.so file’s path or permissions.

Potential Workarounds

Using OpenSSL

If enabling mcrypt fails, consider using the PHP OpenSSL extension as a replacement for encryption purposes:

  1. Enable the OpenSSL extension in your php.ini file by uncommenting the line: extension=openssl
  2. Restart your web server to apply changes.
  3. Update any Magento code that references MCRYPT_BLOWFISH with equivalent OpenSSL functions.

Best Practices

To avoid such compatibility issues, always ensure you’re using a PHP version supported by your Magento installation and keep both PHP and the platform up-to-date with security patches applied regularly.

For more detailed guidance on maintaining secure PHP environments for e-commerce platforms, I recommend exploring our comprehensive blog posts at Laravel Company.

Conclusion

Resolving this MCRYPT_BLOWFISH undefined constant error involves verifying your PHP configuration and ensuring the necessary extensions are enabled. By following the steps outlined above and adopting best practices for PHP version management, you can effectively address this issue and maintain a stable e-commerce environment.

Remember, keeping your tech stack up-to-date is crucial for avoiding compatibility problems and ensuring the security of your online stores. Always stay informed about the latest updates and recommendations from official channels.

Happy coding!

Extensions Configuration Deployment Errors

Our network