提问者:小点点

如何在MacOS 12上为Laravel开发安装PHP 7.1的mCrypt扩展?


这让我发疯,而遵循所有的在线教程也无济于事。

我刚刚升级到一个运行MacOS Sierra(10.12.1)的新mac,并试图配置我的开发环境。但是,每当我在项目上运行作曲家更新或作曲家安装时,我都会收到以下消息:

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

系统运行的是PHP7.1,因此我还运行了brew安装php71 mcrypt

扩展名=mcrypt。因此已经包含在php中。ini文件,都在我的机器上,我在流浪者机器里试过。

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


共1个答案

匿名用户

由于您正在运行vagrant,因此需要在vagrant机器中安装mcrypt。检查您在vagrant上安装了哪个版本的php,并使用

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

使用以下命令重新启动apache

sudo service apache2 restart