Baranto
Baranto

Reputation: 21

Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH'

I'm using Magento 2. Installed a theme and I want to upgrade my system. (And I'm using AMPPS on Mac)

php bin/magento setup:upgrade

When I command these line in Terminal, get this error:

[ErrorException] Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH'

How can I debug and solve it? Thanks.

Upvotes: 2

Views: 15049

Answers (3)

Noshad
Noshad

Reputation: 23

  • if you are using the PHP 7.1 then run the below command will resolve your mcrypt issue.

sudo apt-get install php7.1-mcrypt

change the php version as per your system, I hope it will help. after installing it do not forget to restart the apache server

if it help mark this as an answer

Upvotes: 1

emanuele
emanuele

Reputation: 7

REINDEX SOLVED PROBLEM MAGENTO 2 ON AMPPS after check mcrypt on extension from AMPPS (AMPPS->PHP->PHP Extension), on OSX :

I typed:

cd /Applications/AMPPS/www/magento/bin/

php bin/magento indexer:reindex

and I diplayed the following error:

[Exception]
Notice: Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH'in/Applications/AMPPS/www/magento/vendor/magento/framework/Encryption/E ncryptor.php on line 397

I solved as follows:

from command line and from home:

sudo vi .bash_profile

insert the line: export PATH="/Applications/AMPPS/php-5.6/bin:$PATH" with the php version used by AMPPS and reboot the command line, in this way magento will use the right PHP version to lunch reindex:

cd /Applications/AMPPS/www/magento/bin/

php bin/magento indexer:reindex

If you would lunch reindex without going to /Applications/AMPPS/www/magento/bin/ you could add in .bash_profile, another line as follows:

opening .bash_profile from home:

vi bash_profile

inserting the line:

export PATH="/Applications/AMPPS/www/magento/bin:$PATH"

and then reboot the terminal lunching only the command:

php bin/magento indexer:reindex

Upvotes: -2

Alana Storm
Alana Storm

Reputation: 166126

MCRYPT_BLOWFISH is a PHP constant. This constant is defined by the mycrypt extension. If your version of PHP has mcrypt installed, this constant is present. The error message you're seeing

Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH'

is telling you that this constant is not present. That means mycrypt is not installed or enabled for the version of PHP you're running. You need to install or enable mcrypt.

Some gotchas.

  • The version of PHP you're running on the command line may be different from the version of PHP you're using for Apache/nginx. $ which php, $ php -v, and php --info can tell you what's available for your CLI PHP

  • You may have the extension installed, but disabled via a php.ini file. You can find which php.ini files you're using in the --info call above, by running a small program that calls phpinfo(), or with $ php --ini

Upvotes: 4

Related Questions