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

时间:2016-12-10 11:51:33

标签: laravel mcrypt php-7.1

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

我刚刚升级到运行MacOS Sierra(10.12.1)的新Mac,我正在尝试配置我的开发环境。但是,每当我在项目中运行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

系统正在运行php 7.1,所以我也运行了brew install php71-mcrypt

extension = mcrypt.so已包含在我的机器上的php.ini文件中,我已经在流浪汉机器内尝试过了。

任何帮助都会非常感激,因为我已经在这2天了!

1 个答案:

答案 0 :(得分:1)

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

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

使用

重启apache
sudo service apache2 restart