如何在 MacOS 12 上安装 php 7.1 的 mcrypt 扩展以进行 Laravel 开发?

How do I install mcrypt extension for php 7.1 on MacOS 12 for Laravel development?

这让我发疯,遵循所有在线教程都没有帮助。

我刚刚升级到新的 mac 运行ning MacOS Sierra (10.12.1),正在尝试配置我的开发环境。但是,每当我在我的项目上 运行 composer update 或 composer install 时,我都会收到以下消息:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20131226/mcrypt.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20131226/mcrypt.so, 9): image not found in Unknown on line 0
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.35 -> satisfiable by laravel/framework[v5.0.35].
    - laravel/framework v5.0.35 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
  Problem 2
    - laravel/framework v5.0.35 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - tom-lingham/searchy 2.0.10 requires illuminate/support 5.* -> satisfiable by laravel/framework[v5.0.35].
    - Installation request for tom-lingham/searchy 2.0.10 -> satisfiable by tom-lingham/searchy[2.0.10].

  To enable extensions, verify that they are enabled in those .ini files:
    - /etc/php.ini

我有 运行 brew install mcrypt 并且已经安装了。

Warning: mcrypt-2.6.8 already installed

系统是运行ning php 7.1 所以我也运行 brew install php71-mcrypt

extension=mcrypt.so 已包含在 php.ini 文件中,在我的 machine 上和我在 vagrant machine 中都尝试过。

任何帮助将不胜感激,因为我已经在这里工作了 2 天了!

因为你是运行流浪者,你需要在流浪者机器中安装mcrypt。检查你在 vagrant 上安装的 php 版本并使用

安装 mcrypt
sudo apt-get install *{mcrypt-version-here}*

使用

重启apache
sudo service apache2 restart