Jump to content

How to enable MCRYPT module in PHP/ZF?


takeme2web

Recommended Posts

Dear Experts,

 

Q: How to enable MCRYPT module in PHP/ZF?

 

I have done the following;

1. Ensured that libmcrypt.dll and php_mcrypt.dll are in the c:\php\ext directory.

2. php.ini file modified to include the following;

extension_dir = "c:\php\ext"

extension=php_mcrypt.dll

include_path=".;c:\php\ext;C:\php\pear;c:\php\includes;c:\zendframework196\library"

3. Restarted Apache.

4. I am running the following code in my Test2Controller.php file

$inputtext = $this->_request->getParam('inputtext');

$key = 'SomeSaltKeyThatIsASecret';

$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);

$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);

$encryptedtext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $inputtext, MCRYPT_MODE_ECB, $iv);

$decryptedtext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $encryptedtext, MCRYPT_MODE_ECB, $iv);

 

Still I am getting the following error;

Fatal error: Call to undefined function mcrypt_get_iv_size() in C:\local\myapps\application\controllers\Test2Controller.php on line 42

 

 

I have referred to PHP documentation and searched online for help. Look like I am doing the right things. Is there anything that I am missing in enabling the mcrypt module. In the PHP documentation "Installation:

You need to compile PHP with the --with-mcrypt[=DIR] parameter to enable this extension. DIR is the mcrypt install directory. Make sure you compile libmcrypt with the option --disable-posix-threads."

which I dont understand. Please Help.

Regards

Takeme2Web-Bala

Link to comment
https://forums.phpfreaks.com/topic/191137-how-to-enable-mcrypt-module-in-phpzf/
Share on other sites

All,

I figured out (ofcourse based on online info for someother similar issues) and little bit of reviewing the Apache error log.

Apache error log showed the following error;

PHP Warning:  PHP Startup: Unable to load dynamic library 'c:\\php\\ext\\php_mcrypt.dll' - The specified module could not be found.\r\n in Unknown on line 0

 

 

1. copy the libmcrypt.dll into c:\windows\system32 directory (NOTE: I did not have to copy the php_mcrypt.dll)

2. Restart Apache.

3. All is Well...!

 

Regards

Takeme2Web-Bala

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.