1
votes

I am getting below error

ERROR - 2018-10-01 12:05:23 --> Severity: error --> Exception: Call to undefined function mcrypt_create_iv() /var/www/html/application/controllers/api.php 331

deploying app on AWS EC2 ubuntu 16( Php 7.2, Nginx, codeigniter 3.1.9)

3

3 Answers

8
votes

mcrypt is removed from php7.2. can not use in PHP 7.2. i have created new function and added in common helper.

if (!function_exists('mcrypt_create_iv')) {
    function mcrypt_create_iv($length) {
        return openssl_random_pseudo_bytes($length, NULL);
    }
}

might be helpful to other users.

0
votes

install mcrypt

sudo apt-get install php7.2-mcrypt
sudo systemctl restart nginx.service
0
votes

This polyfill is useful for backwards compatibility w/ mcrypt on PHP 7.3:

https://github.com/phpseclib/mcrypt_compat