dpl3350 2013-03-04 13:59
浏览 57
已采纳

PHP 5.3.18 Mcrypt错误:无法打开源设备

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:

  • Shared hosting
  • PHP 5.3.18
  • Linux
  • Mcrypt 2.5.8

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.

  • 写回答

1条回答 默认 最新

  • doucheng1891 2013-03-04 14:04
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算