php_mcrypt: Call to undefined function mcrypt_create_iv()
Posted by: treadmill (---.zen.co.uk)
Date: May 20, 2008 12:13AM

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_ECcool smiley, 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_ECcool smiley, 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.

Options: ReplyQuote
Re: php_mcrypt: Call to undefined function mcrypt_create_iv()
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 20, 2008 12:26AM

/usr/local/apache2/davy/www/DavyWeb/classes/


this is a path on linux.. and not on wamp... ul need to edit the code to point to c:/wamp/www/davyweb

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote


Sorry, only registered users may post in this forum.