简体   繁体   中英

How to solve composer problem - laravel/framework [..] requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system

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=

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM