laravelmcryptphp-7.1

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


This is driving me crazy and following all the online tutorials hasn't helped.

I have just upgraded to a new mac running MacOS Sierra (10.12.1) and am trying to get my development environment configured. However, whenever I run composer update or composer install on my project I get the following message:

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

I have run brew install mcrypt and it is already installed.

Warning: mcrypt-2.6.8 already installed

The system is running php 7.1 so I have also run brew install php71-mcrypt

extension=mcrypt.so has been included in the php.ini files, both on my machine and I have tried it inside the vagrant machine.

Any help would be much appreciated as I have been at this for 2 days now!


Solution

  • Since you are running vagrant, you need to install mcrypt within the vagrant machine. check which version of php you have installed on vagrant and install mcrypt using

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

    restart apache using

    sudo service apache2 restart