I'm getting an error with the Mcrypt library on my webhost. I'm using the Laravel 4 framework (currently in beta). It's giving the following error:
ErrorException: Warning: mcrypt_create_iv() [function.mcrypt-create-iv]: Cannot open source device in foo/bar line #
Some hosting specs:
What's happening is that somewhere in the framework mcrypt_create_iv() gets called. It passes the MCRYPT_DEV_URANDOM global which should work on Linux and PHP >= 5.3.0
But for some reason it still gives this ErrorException. If I hardcode the function to use MCRYPT_RAND instead it works but it seems odd to my why it's giving an error on the other global which should by all means work on these specs.
All I can think of is that somewhere some folders got mixed up or there's something wrong with /dev/urandom. I'm not familiar with these types of encryption so I'm hoping anyone can give me some suggestion on how to fix it.
http://en.wikipedia.org/wiki//dev/random
UPDATE
Someone suggested that my website doesn't has access to the encryption folders. This could be the problem. I'm contacting my webhost about it.
My first guess is that your website does not have access to the folder from within the document root of the site. If this is on shared hosting, they may have this blocked. I would suggest calling them and finding out about that.
Because /dev/random is a file on the root of the machine, most shared hosting providers do not allow access to folders at this level.