0

I am upgrading php 7.x to 8.0 in CodeIgniter in local wamp server in windows 10. I found this error :-

Message: Undefined constant "MCRYPT_RIJNDAEL_128"

My code is like this:-

$password = trim(openssl_encrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv), "\0..\32");

Error display like this:- enter image description here

chirag p
  • 204
  • 3
  • 10
  • Or this? https://stackoverflow.com/questions/54126215/how-to-resolve-mcrypt-error-use-of-undefined-constant-mcrypt-rijndael-128-in – Nico Haase Dec 15 '21 at 09:15
  • Its not working so I put new question here.. @NicoHaase – chirag p Dec 15 '21 at 09:49
  • What is "it"? What have you tried to resolve the problem? Where are you stuck? – Nico Haase Dec 15 '21 at 09:57
  • @NicoHaase I put extension=extname AND extension=php_extname.dll in php.ini and restart wamp. I download libmcrypt-2.5.8.tar.gz but I dont know how to apply it. – chirag p Dec 15 '21 at 10:03
  • Did you try to look this up using any search engine? https://stackoverflow.com/questions/37522384/how-to-install-mcrypt-extension-in-xampp shows hints about how to install MCrypt for WAMPP – Nico Haase Dec 15 '21 at 10:16
  • My php version is 8.0. And this version is not displayed in https://pecl.php.net/package/mcrypt/1.0.3/windows – chirag p Dec 15 '21 at 10:25
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/240165/discussion-between-chirag-p-and-nico-haase). – chirag p Dec 15 '21 at 10:27
  • 1
    Why not install v1.0.4, which is the most recent version of that extension, from https://pecl.php.net/package/mcrypt/1.0.4/windows? PHP 8 has been released at the end of 2020, v1.0.3 of that extension is more than a year older, and it's pretty obvious that it cannot be compatible with PHP 8 – Nico Haase Dec 15 '21 at 10:27

1 Answers1

1

From php.net:

This extension has been moved to the » PECL repository and is no longer bundled with PHP as of PHP 7.2.0

You can try install mcrypt extension via pecl. In my case it's Ubuntu:

pecl install mcrypt

For windows

Dmitry Leiko
  • 3,970
  • 3
  • 25
  • 42
  • I have Wamp server in my local pc with windows 10 @Dmitry. I tried your steps but not working. I put extension=extname AND extension=php_extname.dll in php.ini and restart wamp. Nothing happen ! – chirag p Dec 15 '21 at 09:54
  • @chiragp also you can check this - https://stackoverflow.com/questions/52590607/download-and-install-the-php-mcrypt-extension-under-windows-10 – Dmitry Leiko Dec 15 '21 at 10:25