Laravel需要php56-mcrypt,但我无法安装php56-mcrypt

时间:2018-06-04 23:47:45

标签: php laravel homebrew

我正在尝试运行一个旧的Laravel项目,但是当我尝试运行composer install时,我收到此错误:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for laravel/framework v5.0.32 -> satisfiable by laravel/framework[v5.0.32].
    - laravel/framework v5.0.32 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
  Problem 2
    - laravel/framework v5.0.32 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - barryvdh/laravel-ide-helper v2.0.3 requires illuminate/console 5.0.x -> satisfiable by laravel/framework[v5.0.32].
    - Installation request for barryvdh/laravel-ide-helper v2.0.3 -> satisfiable by barryvdh/laravel-ide-helper[v2.0.3].

我正在使用的php可执行文件位于此处:

/usr/local/Cellar/php@5.6/5.6.30_6/bin/php

我已将extension=mcrypt.so添加到我能找到的每个php.ini(包括我放在Laravel项目根目录中的那个)。

我不知道这是否相关(我的Mac上似乎有十几个或更多的php版本)。

所以我一直在尝试安装mcrypt但是我发现的每个答案似乎都已经过时了。这就是我尝试过的:

brew install homebrew/php/php56-mcrypt

输出:Error: No available formula with the name "homebrew/php/php56-mcrypt"

brew install php@5.6 -with-mcrypt=mcrypt

这似乎安装成功,但不能解决错误。

brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php56-mcrypt

输出:Error: No available formula with the name "php56-mcrypt"

我应该如何在Mac上安装php56-mcrypt

1 个答案:

答案 0 :(得分:0)

试试这个: - brew install php56-mcrypt --without-homebrew-php

并在/private/etc/php.ini中添加此扩展程序: -

扩展= "/usr/local/Cellar/php56-mcrypt/5.6.x/mcrypt.so"

编辑: - 首先尝试按如下方式添加点按: - brew tap homebrew/homebrew-php然后运行安装命令。