1

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)

James Z
  • 12,209
  • 10
  • 24
  • 44
Hemant Hingave
  • 126
  • 1
  • 4

3 Answers3

8

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.

Hemant Hingave
  • 126
  • 1
  • 4
0

install mcrypt

sudo apt-get install php7.2-mcrypt
sudo systemctl restart nginx.service
Mafei
  • 3,063
  • 2
  • 15
  • 37
0

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

https://github.com/phpseclib/mcrypt_compat

rocksfrow
  • 851
  • 8
  • 12