1
votes

I downgraded to PHP 5.2.8 from PHP 5.4.2 for a reason, I enabled the mcrypt extension, but when I run the function mcrypt_create_iv ($size, MCRYPT_DEV_RANDOM), it doesn't execute properly, and I get the following warning

Warning: mcrypt_create_iv() [function.mcrypt-create-iv]:Cannot open source device

Please how do I fix this issue? Thanks for any suggestion.

3

3 Answers

3
votes

The issue occurred because MCRYPT_DEV_URANDOM was only supported on Windows as from PHP version 5.3.0, that is why it was working well until the downgrade.

I changed to MCRYPT_RAND which worked on previous versions and the problem was solved.

1
votes

Locate the file includes/CryptRandom.php. Find the following line (probably around line 285): $iv = mcrypt_create_iv( $rem, MCRYPT_DEV_URANDOM ); Change it to: $iv = mcrypt_create_iv( $rem, MCRYPT_RAND );

Source

0
votes

Check the device file (if Linux):

/dev/random