Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH'

Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH'

September 11, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH'

Resolving the “Use of undefined constant MCRYPT_BLOWFISH” Error in Magento 2 on macOS

If you’re facing the [ErrorException] Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH' error while trying to upgrade your Magento 2 installation using AMPPS on a Mac, don’t worry—you can fix this issue with a few simple steps.

Understanding the Error

This error occurs because PHP isn’t able to locate the MCRYPT_BLOWFISH constant, which is required for some of Magento’s core functions. The assumption made by PHP is causing the undefined constant error you’re seeing.

To resolve this, we need to ensure that the mcrypt PHP extension is enabled in your environment.

Enabling the Mcrypt Extension

AMPPS provides a convenient way to manage PHP extensions. Here’s how to enable the mcrypt extension:

  1. Open the AMPPS application on your Mac.

  2. Click on the Tools menu and select PHP Configuration.

  3. Under the php.ini file for your PHP version (usually 7.x), find or add the following line:

    extension=mcrypt.so
    
  4. Save the changes to the php.ini file.

  5. Restart your AMPPS server by clicking on the Restart All Servers button in the main interface.

Running the Upgrade Command Again

After restarting the servers, open a new terminal window and navigate to your Magento 2 installation directory:

cd /path/to/your/magento/installation

Now, run the upgrade command again:

php bin/magento setup:upgrade

This time, you should see that the error has been resolved, and the upgrade process will proceed without any issues.

Ensuring Other Extensions are Installed

If the mcrypt extension is still not showing up, or if you encounter other undefined constant errors like MCRYPT_RIJNDAEL_128, you might need to install the OpenSSL extension as well. Follow these steps:

  1. In the AMPPS PHP Configuration window, add the following line under the same php.ini file:

    extension=openssl.so
    
  2. Save the changes and restart your servers.

  3. Try running the upgrade command again.

Conclusion

Addressing this error involves properly configuring your environment to ensure that all necessary PHP extensions are enabled. By correctly setting up AMPPS and managing your PHP configuration, you can avoid undefined constant errors and enjoy a smoother Magento 2 upgrade experience.

Remember, always backup your data before performing any upgrades. If you’re looking for professional assistance with your Magento 2 setup or migrations, consider reaching out to the experts at Laravel Company.

Happy coding!

Magento 2 API Extensions Configuration

Our network