0

I get this error while using Phpass 0.3 on my CI Controller

Message:

is_readable() [function.is-readable]: open_basedir restriction in effect. File(/dev/urandom) is not within the allowed path(s): (/home/:/usr/lib/php:/usr/local/lib/php:/tmp)

Filename: phpass-0.3/PasswordHash.php

Can someone tell me what the problem is?

Arctodus
  • 5,743
  • 3
  • 32
  • 44
Mayfield Four
  • 95
  • 3
  • 9

1 Answers1

0

open_basedir is a directive defined in your php.ini file.

It is set to the lowest directory that you are allowed to access from a PHP script, usually your webroot.

Trying to access a file/directory further down the tree such as in /dev/ will then be dissallowed and you will get the message you have.

You will have to edit your php.ini and set open_basedir to your server root, which is generally a bad thing security-wise as if anyone managed to inject malicious code into your script they would have access to the entire system.

It would be safer to exececute a script (Perl, Python, etc) that lives in your web folder to read /dev/urandom if you really need to.

$output = `/scripts/get_urandom.pl`;
// Process output

Version 1.8 of phpass resolves this issue by suppressing the error:

Changes since revision 1.7: +2 -2 lines:

Prefixed is_readable() with "@" to suppress warning when open_basedir restriction is in effect.

Dan Brown
  • 111
  • 1
  • 1
  • 6