在ubuntu 14.04上安装laravel时出现ext-mcrypt错误


ext-mcrypt error while installing laravel on ubuntu 14.04

我是ubuntu 14.04中laravel的初学者。我试着运行以下对安装laravel的赞扬。

composer create-project laravel/laravel --prefer-dist

我犯了以下错误。我也尝试安装ncrypt,但我得到了同样的错误。

Installing laravel/laravel (v5.0.1)
      - Installing laravel/laravel (v5.0.1)
        Loading from cache
    Created project in /opt/lampp/htdocs/laravel
    Loading composer repositories with package information
    Installing dependencies (including require-dev)
    Your requirements could not be resolved to an installable set of packages.
      Problem 1
        - laravel/framework v5.0.2 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
        - laravel/framework v5.0.1 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
        - laravel/framework v5.0.0 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
        - Installation request for laravel/framework 5.0.* -> satisfiable by laravel/framework[v5.0.0, v5.0.1, v5.0.2].

我也试图运行这个命令,但我得到了同样的错误。

sudo apt-get install mcrypt php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart

提前谢谢。。

我打开这个文件

gedit /etc/php5/cli/php.ini

在这个文件中放入一行

extension=mcrypt.so

并且这次运行成功。

无论如何,再次感谢。

这就是我在Mac Yosemite上解决问题的方法。我在/etc/中有一个php.ini,我有mcrypt instaIled。但我也面临同样的问题。

运行此程序以查找另一个php.ini。

php -i|grep ini

它返回了以下内容。

System => Darwin Myname-MacBook-Pro.local 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Configuration File (php.ini) Path => /usr/local/etc/php/5.5
Loaded Configuration File => /usr/local/etc/php/5.5/php.ini
....

我打开/usr/local/etc/php/5.5/php.ini并将extension=mcrypt.so添加到文件中。

我希望这对将来的人有所帮助。

使用brew的Mac用户仅在CLI:中运行

brew install php56-mcrypt

Doinion戒指。