|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74130 /dev/urandom
Submitted: 2017-02-19 19:12 UTC Modified: 2017-02-19 19:16 UTC
From: bart at jdsoft dot be Assigned:
Status: Duplicate Package: *Encryption and hash functions
PHP Version: 7.0.16 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
45 - 2 = ?
Subscribe to this entry?

 [2017-02-19 19:12 UTC] bart at jdsoft dot be
Unable to generate a random value

Test script:
echo "<?php random_bytes(10);" | php   

Actual result:
PHP Fatal error:  Uncaught Exception: Could not gather sufficient random data in -:1                                                                                                                                             
Stack trace:                                                                                                                                                                                                                     
#0 -(1): random_bytes(10)                                                                                                                                                                                                        
#1 {main}                                                                                                                                                                                                                        
  thrown in - on line 1  


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-19 19:16 UTC]
-Status: Open +Status: Duplicate
 [2017-02-19 19:16 UTC]
As said in the documentation, this happens on Linux if the system does not support the getrandom(2) syscall. That has been fixed with bug #74105.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Dec 07 05:01:29 2023 UTC