0

I did copy a laravel project from External server to my local server when I tried to type composer install it showed the folowing error

Problem 1 - laravel/framework v5.0.16 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.16 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system. - Installation request for laravel/framework v5.0.16 -> satisfiable by laravel/framework[v5.0.16].

I have windows 10 system, and it's an old project so I installed the php 5 with xampp

I tried to add extension=php_mcrypt.so but it didn't work

I added a dll file in system32 also but didn't work

and php.ini look like this

[mcrypt]
; For more information about mcrypt settings see http://php.net/mcrypt-module-open

; Directory where to load mcrypt algorithms
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
;mcrypt.algorithms_dir=

; Directory where to load mcrypt modes
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
;mcrypt.modes_dir=
neubert
  • 15,947
  • 24
  • 120
  • 212
Zouari Moez
  • 63
  • 1
  • 9
  • 1
    Possible duplicate of [Laravel requires the Mcrypt PHP extension](https://stackoverflow.com/questions/16830405/laravel-requires-the-mcrypt-php-extension) – rob006 Aug 06 '19 at 16:11
  • Try doing `composer require phpseclib/mcrypt_compat` via the CLI. – neubert Aug 07 '19 at 20:32
  • Are you sure this problem is related to Laravel itself? What have you tried to resolve it? Where are you stuck? – Nico Haase Aug 30 '23 at 18:06

2 Answers2

0

Refer to laravel documentation for Laravel 5.0 installation

In case of Windows:

  1. Edit php.ini
  2. add extension=mcrypt.so on Dynamic Extension section
  3. restart server

In case of Ubuntu:

check php version

php -v

Try installing mcrypt extension by below commands,

//for php version 5
sudo apt-get install mcrypt
sudo apt-get install php5-mcrypt

//for php version 7.2
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo pecl install mcrypt-1.0.1
sudo apt-get -y install php7.2-dev
sudo apt-get -y install libmcrypt-dev

After mcrypt installs properly, go ahead with your laravel installation

composer create-project laravel/laravel {directory} "5.0.*" --prefer-dist
Dharman
  • 30,962
  • 25
  • 85
  • 135
Ankit Jindal
  • 3,672
  • 3
  • 25
  • 37
-2

You can try this

 1. cd /etc/php5/cli/conf.d

 2. ln -s ../../mods-available/mcrypt.ini 20-mcrypt.ini

if this not work Install mcrypt extension

I tried both:

sudo apt-get install mcrypt
sudo apt-get install php5-mcrypt

Configure php.ini for CLI

Then, edit php.ini located in /opt/lampp/etc/php5/cli/php.ini add extension=mcrypt.so on Dynamic Extension section (anywhere is fine I think). Don't forget to restart your server.

Bilawal Awan
  • 422
  • 3
  • 13
  • I have windows where is etc location ? – Zouari Moez Aug 05 '19 at 21:08
  • you install the mcrypt and read installation process here [link](https://www.myoddweb.com/2010/11/18/install-mcrypt-for-php-on-windows/) and then you need to go to the `php` folder of your xampp and add the `extension=mcrypt.so` on Dynamic Extension section (anywhere is fine I think). Don't forget to restart your server. – Bilawal Awan Aug 05 '19 at 21:26
  • None of the commands mentioned in this answer works on the windows operating system (which is specifically asked for in question). – Nicolai Fröhlich Aug 09 '19 at 13:25