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 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?