php error: The Encrypt library requires the Mcrypt extension in codeigniter

后端 未结 10 955
渐次进展
渐次进展 2020-12-10 13:30

I have a login and sign up form and use the encrypt library to encrypt the password.. I am using Xampp for my server and my system works correctly..

code to encrypt

10条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-10 14:01

    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.

提交回复
热议问题