安装php5-mcryptsudo apt-get install php5-mcrypt
编辑php配置文件sudo gedit /etc/php5/apache2/php.ini
在extension下面加上(任何独立一行就行)extension=php_mcrypt.so (原来的php5-mcrypt.so无效)
保存,重启apache2
sudo /etc/init.d/apache2 restart
如果重启后你的phpinfo里面并没有mcrypt扩展的话:
方案一:cd /etc/php5/cli/conf.d
sudo ln -s ../../mods-available/mcrypt.ini 20-mcrypt.ini
方案二:cd /etc/php5/cli/conf.d
sudo ln -s ../../mods-available/mcrypt.ini 20-mcrypt.ini
php5enmod mcrypt
service apache2 restart
ps:对于Ubuntu,简单的安装php5-mcrypt并不能正常工作,你需要以root用户执行上面方案二的命令去启用它;