Hi All,
I'm trying to use the php_mcrypt module that came with WAMP. I have enabled it via the WAMP control panel, however, when I try to use it, I get the following error:
Code:
<?php
class ENCRYPTION
{
public $KEY = 'somenicekey';
public $STRING = '';
public $RETURN_VALUE = '';
//Encrypt Function
public function encrypt()
{
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_EC
, MCRYPT_RAND);
$passcrypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->KEY, $this->STRING, MCRYPT_MODE_ECB, $iv);
$encoded = base64_encode($passcrypt);
$this->RETURN_VALUE = $encoded;
}
//Decrypt Function
public function decrypt()
{
$decoded = base64_decode($this->STRING);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_EC
, MCRYPT_RAND);
$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->KEY, $decoded, MCRYPT_MODE_ECB, $iv);
$this->RETURN_VALUE = trim($decrypted);
}
}
?>
Error:
Fatal error: Call to undefined function mcrypt_create_iv() in /usr/local/apache2/davy/www/DavyWeb/classes/encryption.php on line 11
Any ideas what I'm doing wrong? Apache restarts find with the module enabled and no errors are reported in the PHP or Apache error logs to do with the module. So, all seems ok.
BTW, this works fine working on Linux.
Edited 2 time(s). Last edit at 05/20/2008 12:16AM by treadmill.