The Encrypt library requires the Mcrypt extension

the encrypt library requires the mcrypt extension. php 7.2 windows
the encrypt library requires the mcrypt extension wamp
the encrypt library requires the mcrypt extension. codeigniter xampp windows
the encrypt library requires the mcrypt extension windows 10
the encrypt library requires the mcrypt extension. cpanel
the encrypt library requires the mcrypt extension. xampp windows 10
the encrypt library requires the mcrypt extension. codeigniter windows
the encrypt library requires the mcrypt extension. php 7 windows

I have a php application written using codeigniter framework. When I am trying to run this application on Windows Machine then I am getting below error:

An Error Was Encountered The Encrypt library requires the Mcrypt extension.

This same application working fine on some random Windows Machine having same configuration.I have tried on 5 different windows 10 machine and got this error on 3 Machine and worked fine on 2 machine. Here I have used the same installer to install XAMPP on all the machine and same code, but still don't know how to make it run smoothly. I have tried almost all the suggestion available online like to make change in php.ini but no luck so far.

(FOR CI USERS only) If you are switched from CI2 XAMPP(php5) to XAMPP(php7) then, paste encrypt.php in CI->system->libraries folder, after this it should be fine !

The Encrypt library requires the Mcrypt extension, (FOR CI USERS only) If you are switched from CI2 XAMPP(php5) to XAMPP(​php7) then, paste encrypt.php in CI->system->libraries folder, after  Laravel Requires the Mcrypt PHP Extension for 256-bit encryption/decryption. It is a encryption Algorithm,Supports many encryption algorithms. Here is the list of supported encryption’s. DES, TripleDES, Blowfish (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and GOST in CBC, OFB, CFB and; ECB cipher modes.

For the future comers, I have face this problem too. It is usually issue with php 7.2.

Simply replace encrypt with encryption in autoload.php

$autoload['libraries'] = array('database', 'email', 'session', 'encrypt', 'pagination');

$autoload['libraries'] = array('database', 'email', 'session', '**encryption**', 'pagination');

Codeigniter (Ubuntu 16.04), The Encrypt library requires the Mcrypt extensions. in this video will help you how to fix that Duration: 3:06 Posted: Apr 12, 2017 Your encryption key must be as long as the encryption algorithm in use allows. For AES-256, that’s 256 bits or 32 bytes (characters) long. The key should be as random as possible, and it must not be a regular text string, nor the output of a hashing function, etc. To create a proper key, you can use the Encryption library’s createKey() method.

On Linux where PHP 5.6 or less...

apt-get install php5-mcrypt

The Encrypt library requires the Mcrypt extension. Fixed Codeigniter , if (($this->_mcrypt_exists = function_exists('mcrypt_encrypt')) === FALSE). {. show_error('The Encrypt library requires the Mcrypt extension.');. }. The mcrypt extension is a replacement for the UNIX crypt command. These commands serve as a means to encrypt files on UNIX and Linux systems. The php-mcrypt extension serves as an interface between PHP and mcrypt.

I was using PHP 7.2.xx version of php and followed the following steps:

Mcrypt PECL extenstion

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libmcrypt-dev
sudo pecl install mcrypt-1.0.1

Update the ini file with these commands:

sudo bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.2/cli/conf.d/mcrypt.ini"
sudo bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.2/apache2/conf.d/mcrypt.ini"

Verifying the installation:

php7.2-sp -i | grep mcrypt

system/libraries/Encrypt.php from bcit-ci/CodeIgniter, To do so in a cryptographically secure way, it utilizes PHP extensions t show_error('The Encrypt library requires the Mcrypt extension.'); }. The Encrypt library requires the Mcrypt extension. This same application working fine on some random Windows Machine having the same configuration. I have tried on 5

Open php.ini

search for ;extension=php_mcrypt.dll

then remove ; infront of it to uncomment it.

save the php.ini file

Getting mcrypt extension not available error · Issue #5559 · bcit-ci , Codeigniter 2.2 displays error, “The Encrypt library requires the Mcrypt extension.​” I'm running PHP 5.6.2 (via MAMP) on Yosemite 10.10.1. Right from the PHP Docs: PHP 5.3 Windows binaries uses the static version of the MCrypt library, no DLL are needed. http://php.net/manual/en/mcrypt.requirements.php

Mcrypt is installed, but error implies it's not., The Encrypt Class provides two-way data encryption. It encrypted using the Mcrypt PHP extension, which is required for the Encrypt Class to run. This library has been DEPRECATED and is only kept for backwards compatibility. Please use the new Encryption Library. The Encrypt library requires the Mcrypt extension January 12, 2019 — Mas Adi . Mengatasi The Encrypt library requires the Mcrypt extension.

Encrypt Class, You can override default library with your own library. You can try below code: Create a file: /codeigniter/application/libraries/MY_Encrypt.php. Save Time Managing Documents. No Installation Needed. Try Now!

The Encrypt library requires the Mcrypt extension in codeigniter , The Encrypt library requires the Mcrypt extension in codeigniter. Setelah mencari beberapa referensi ternyata solusinya cukup simple yakni 

Comments
  • So, install (or enable) the extension. This is something you should have googled about.
  • Be aware that mcrypt was DEPRECEATED in version 7.1 of PHP and has been REMOVED from version 7.2 of PHP
  • I am using PHP Version 7.2.4 if possible could you please suggest the workaround to solve it
  • Possible duplicate of php error: The Encrypt library requires the Mcrypt extension in codeigniter
  • It works also for non-XAMPP configurations, but I did not copy the file but based on it I made the appropriate corrections on the side of my application.
  • This has worked but I could not tell what you changed because this file exists in the folder. Just replaced its content.
  • mccrypt is not enabled on the machine where i am getting error. So, do i need to enable it ? if so then how ?
  • Could you please give me the steps to make it enable
  • If you have access to the php.ini file you should be able to enable it. you probably have to uncomment a line within the php.ini refering to it by removing the ; before that line.
  • @RahulKumarSingh Updated answer for enabling extension.
  • This doesn't solve the problem since you just removed the encryption libraries from the $autoload[libraries] array