【问题标题】:ext-mcrypt error while installing laravel on ubuntu 14.04在 ubuntu 14.04 上安装 laravel 时出现 ext-mcrypt 错误
【发布时间】:2015-02-09 09:37:16
【问题描述】:

我是 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

提前谢谢..

【问题讨论】:

标签: php laravel


【解决方案1】:

我正在打开这个文件

gedit /etc/php5/cli/php.ini

在这个文件中加入一行

extension=mcrypt.so

并且运行成功。

再次感谢。

【讨论】:

  • Windows 怎么办?
【解决方案2】:

这就是我在 Mac Yosemite 上解决的方法。我在 /etc/ 中有一个 php.ini,并且我安装了 mcrypt。但是我遇到了同样的问题。

运行它以找到另一个 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 添加到文件中。

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

【讨论】:

    【解决方案3】:

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

    brew install php56-mcrypt
    

    Doinion 戒指。

    【讨论】:

      猜你喜欢
      • 2015-11-01
      • 1970-01-01
      • 2014-08-19
      • 2015-06-12
      • 1970-01-01
      • 2019-10-11
      • 2016-09-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多