I am using Mamp server on Mac OSX. I am trying to implement the cryptography in my project for client side cookies. I am getting warning
Warning: mcrypt_module_open() [function.mcrypt-module-open]: Could not open encryption module
I checked in the php.ini file and there is no semicolon in front of the mcrypt extension. Can someone help with this issue.
Thanks in advance
The mcrypt module is enabled in your php.ini, otherwise you would get an error message along the lines Call to undefined function.
What it indicates is that the requested cipher method is not available. You have either a typo, or one of the ciphers is not compiled into your version of mcrypt.so.
mcrypt_module_open('rijndael-256', '', 'ofb', ''); // works
mcrypt_module_open('wrong', '', '', ''); // generates your error
The manual page and the extra parameters indicate that the libmcrypt on your system might depend on shared modules itself. So you might want to search for another version. Try a MAMP update, or use the pro version that exists for that PHP distribution.
I am also using this sample from George Schlassnagles "Advanced PHP Programming" (page 334ff). This code includes some mistakes. As you refer to a static variable I think you have to call it with self::$var.
This one should work:
mcrypt_module_open(self::$cipher, '', self::$mode, '');
Note, that there are some more mistakes like:
$ivsize = mcrypt_get_iv_size(self::$cypher, self::$mode);If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With