Victor
Victor

Reputation: 31

The Encrypt library requires the Mcrypt extension error

I am getting this error message in CI and I am using XAMPP:

An Error Was Encountered

The Encrypt library requires the Mcrypt extension.

I already look for other similar post but still have not found the right answer.

I try this adding this script in my php.ini XAMPP:

extension=php_mcrypt.dll

line 887.

and restart my xampp. but the same error still appears.

Thanks.

Upvotes: 2

Views: 7228

Answers (2)

mohitesachin217
mohitesachin217

Reputation: 461

I was getting this error because i had switched from XAMPP(php5) to XAMPP(php7), for this I replaced my old CI->system->libraries->encrypt.php with new file here:encrypt.php, and it worked.

In this new file we check if mcrypt_encrypt is supported or not in __construct function with code below

   $this->_mcrypt_exists = ( ! function_exists('mcrypt_encrypt')) ? FALSE : TRUE;

and based on that we use different function between mcrypt_encode and _xor_encode like that.

Just to know, if you see this old file in __construct function you will see actual error checking

    if (($this->_mcrypt_exists = function_exists('mcrypt_encrypt')) === FALSE)
    {
        show_error('The Encrypt library requires the Mcrypt extension.');
    }

It worked for me.

Upvotes: 1

Victor
Victor

Reputation: 31

It finally works after I move the server from PHP 7 to PHP 5 xampp server.

Upvotes: 0

Related Questions