2

I have new in laravel I have set up laravel 5.5 in my system and its installed but when i start to use php artisan migrate its give error

Mcrypt PHP extension required

But when I run the phpinfo on browser there is mcrypt enable but its show the

PHP Version 7.1.12

But in terminal when I run the

php -v

its result

PHP 7.2.2-3+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Feb 6 2018 16:11:23) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.2-3+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies I think Mycrypt not installed in the cli php How can I fix it and make a laravel project

Thanks in advance

Priyanka Sankhala
  • 808
  • 1
  • 9
  • 25

2 Answers2

2

As it mentioned here: https://stackoverflow.com/a/37761637/8489245

You can try to install it with :

sudo apt-get update
sudo apt-get install mcrypt php7.2-mcrypt
sudo apt-get upgrade

if php7.2-mycrypt does not exist you can try to go back to version 7-0 of php and install it with :

sudo apt-get install mcrypt php7.0-mcrypt

Hope it help you!

Aboubacar Ouattara
  • 511
  • 1
  • 6
  • 18
2

mcrypt was deprecated in php7.1 and removed in 7.2.

From the release notes of Laravel 5.1:

In previous versions of Laravel, encryption was handled by the mcrypt PHP extension. However, beginning in Laravel 5.1, encryption is handled by the openssl extension, which is more actively maintained.

So you should be using openssl_encrypt, libsodium or another supported library.

Currently enabled modules:

$ php -m
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
soap
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
  • Thanks for reply but how to manage this because Lavavel want the Mcrypto lib only. – Priyanka Sankhala Feb 18 '18 at 06:53
  • Try installing `openssl_encrypt`/`libsodium`, it is the extension I'm using. I have applications on Laravel 5.5 and 5.6, neither are using mcrypt. –  Feb 18 '18 at 07:02