我正在使用 Magento 2。安装了一个主题,我想升级我的系统。(我在 Mac 上使用 AMPPS)
php bin/magento setup:upgrade
当我在终端中命令这些行时,出现此错误:
[ErrorException] 使用未定义的常量 MCRYPT_BLOWFISH - 假定为“MCRYPT_BLOWFISH”
我该如何调试和解决它?谢谢。
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
sudo apt-get install php7.1-mcrypt
根据您的系统更改php版本,我希望它会有所帮助。安装后不要忘记重新启动apache服务器
如果它有助于将此标记为答案
在 OSX 上从 AMPPS(AMPPS->PHP->PHP 扩展)检查 mcrypt 后,REINDEX 解决了 AMPPS 上的 MAGENTO 2 问题:
我输入:
cd /Applications/AMPPS/www/magento/bin/
php bin/magento indexer:reindex
我显示了以下错误:
[例外]
注意:使用未定义的常量 MCRYPT_BLOWFISH - 在第 397 行的/Applications/AMPPS/www/magento/vendor/magento/framework/Encryption/Encryptor.php 中假定为“MCRYPT_BLOWFISH”
我解决如下:
从命令行和家中:
sudo vi .bash_profile
插入行:export PATH="/Applications/AMPPS/php-5.6/bin:$PATH"
使用AMPPS使用的php版本并重新启动命令行,这样magento将使用正确的PHP版本来午餐reindex:
cd /Applications/AMPPS/www/magento/bin/
php bin/magento indexer:reindex
如果你想在午餐时重新索引而不去/Applications/AMPPS/www/magento/bin/
你可以添加.bash_profile
,另一行如下:
在家开门.bash_profile
:
vi bash_profile
插入行:
export PATH="/Applications/AMPPS/www/magento/bin:$PATH"
然后重新启动终端,仅使用以下命令:
php bin/magento indexer:reindex