编程语言
首页 > 编程语言> > php-异常:“无法收集足够的随机数据”

php-异常:“无法收集足够的随机数据”

作者:互联网

客户端收到以下错误

CRITICAL: Uncaught PHP Exception Exception: “Could not gather
sufficient random data” at
/…/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php line
69 {“exception”:”[object] (Exception(code: 0): Could not gather
sufficient random data at
/…/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php:69)”}
[]

[更正的客户端PHP版本]

尝试查看或编辑记录.客户端是在freebsd上运行的Symfony 2.8.2,PHP 5.6.18上.我的开发系统是Symfony 2.8.2,PHP 7,Windows 10,并且没有出现此错误.

运行composer更新不会影响此行为.

解决方法:

答案是here,由Scott在paragonie提供.它说,

It means precisely what it says: Something about your environment is
preventing mcrypt_create_iv($numBytesRequested, MCRYPT_DEV_URANDOM)
from generating enough entropy.

Make sure PHP can read /dev/urandom, especially if you’re in a chroot
jail. Without access to the kernel’s CSPRNG, we cannot reliably
generate random data suitable for cryptography.

由于该站点位于共享主机上,而我基本上都是freebsd文盲,因此我将其转发给了主机的网站管理员.问题已解决.

标签:mcrypt,symfony,php
来源: https://codeday.me/bug/20191119/2032472.html