无法安装 php5-mcrypt

无法安装 php5-mcrypt

我试图在 php 下安装 mcrypt,但安装不成功。如果我这样做php test.php | grep mcrypt(其中 test.php 包含phpinfo()),什么都没有出现,所以我想安装它。

如果我这样做,sudo apt-get install php5-mcrypt我会得到这个:

E: Unable to locate package php5-mcrypt

如果我sudo apt-cache search mcrypt什么也不做就会出现这种情况。

这是我的 /etc/apt/sources.list

deb cdrom:[Ubuntu 13.04 _Raring Ringtail_ - Release amd64 (20130424)]/ raring main restricted
deb http://archive.ubuntu.com/ubuntu raring main restricted
deb-src http://archive.ubuntu.com/ubuntu raring main restricted

deb http://security.ubuntu.com/ubuntu raring-security main restricted
deb-src http://security.ubuntu.com/ubuntu raring-security main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu raring-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu raring-updates main restricted

## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
 deb http://archive.ubuntu.com/ubuntu raring universe
 deb-src http://archive.ubuntu.com/ubuntu raring universe
 deb http://archive.ubuntu.com/ubuntu raring-updates universe
 deb-src http://archive.ubuntu.com/ubuntu raring-updates universe
 deb http://security.ubuntu.com/ubuntu raring-security universe
 deb-src http://security.ubuntu.com/ubuntu raring-security universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
 deb http://archive.ubuntu.com/ubuntu raring multiverse
 deb-src http://archive.ubuntu.com/ubuntu raring multiverse
 deb http://archive.ubuntu.com/ubuntu raring-updates multiverse
 deb-src http://archive.ubuntu.com/ubuntu raring-updates multiverse
 deb http://security.ubuntu.com/ubuntu raring-security multiverse
 deb-src http://security.ubuntu.com/ubuntu raring-security multiverse

deb http://us.archive.ubuntu.com/ubuntu/ quantal universe
deb-src http://us.archive.ubuntu.com/ubuntu/ quantal universe
deb http://us.archive.ubuntu.com/ubuntu/ quantal-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ quantal-updates universe

最后一组 deb / deb-src 内容来自http://forums.linuxmint.com/viewtopic.php?f=90&t=135896

根据https://stackoverflow.com/q/19446679/569976这应该有效:

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt

唯一的问题:我没有 /etc/php5/conf.d/mcrypt.ini。

有什么想法吗?我是否必须自己从源代码编译 mcrypt 才能使其在 ubuntu 上运行?我正在运行 Ubuntu 13.04。

谢谢!

答案1

我不确定您是否遇到了与我相同的问题(我运行的是 Ubuntu 13.10,而不是 13.04),但这对我来说很有效。以下是原始答案:https://stackoverflow.com/questions/19446679/mcrypt-not-present-after-ubuntu-upgrade-to-13-10

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt
sudo service apache2 restart

相关内容