某客户在安装 Magento程序的时候,提示错误 PHP extension "mcrypt" must be loaded.
一般来说,进入ssh,执行 yum -y install mcrypt php-mcrypt 即可安装mcrypt支持,然后service httpd restart 即可。可是,我执行 yum -y install mcrypt php-mcrypt 的时候提示mcrypt 已经安装:
Package php-mcrypt-5.1.6-15.el5.centos.1.i386 already installed and latest version
Nothing to do
于是查看下php的版本:
php -v
PHP Warning: PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP 5.2.17 (cli) (built: Jan 7 2011 21:18:16)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies
发现毛病: php版本是5.2,但是php-mcrypt却是5.1版本,难怪有问题。估计是客户在升级到php5.2的时候,没有正确升级好php-mcrypt。
这里我通过下面的命令升级php-mcrypt:
yum --enablerepo=webtatic --exclude=php*5.3* update -y mcrypt mbstring php-mbstring php-mcrypt
service httpd restart
在测试,一切正常。安装Magento错误PHP extension "mcrypt" must be loaded.搞定。 |