2

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.

Victor
  • 31
  • 1
  • 3
  • So most likely the extension is NOT loaded, right? Have you checked if it IS loaded? How? What do your http servers log files say? What does a ``phpinfo()`` say about the extension? Have you installed the extension at all? – arkascha Aug 13 '18 at 05:47
  • for reference you can check here: https://stackoverflow.com/questions/35798048/php-error-the-encrypt-library-requires-the-mcrypt-extension-in-codeigniter/56523924#56523924 – mohitesachin217 Jun 10 '19 at 09:49
  • Possible duplicate of [php error: The Encrypt library requires the Mcrypt extension in codeigniter](https://stackoverflow.com/questions/35798048/php-error-the-encrypt-library-requires-the-mcrypt-extension-in-codeigniter) – mohitesachin217 Sep 18 '19 at 09:40

2 Answers2

1

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.

mohitesachin217
  • 451
  • 5
  • 14
0

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

Victor
  • 31
  • 1
  • 3