2011-11-21 108 views
1

我得到这个错误与PHPass:PHPass错误:函数名必须是一个字符串

Warning: is_readable(): open_basedir restriction in effect. File(/dev/urandom) is not within the allowed path(s): (/customers/example.com/example.com/httpd.www:/customers/example.com/example.com/httpd.private:/customers/example.com/example.com/tmp:/customers/example.com/example.com:/var/www/diagnostics:/usr/share/php) in /customers/example.com/example.com/httpd.www/example/scripts/PasswordHash.php on line 51 Fatal error: Function name must be a string in /customers/example.com/example.com/httpd.www/example/register.php on line 82

线51-54上PasswordHash.php(PHPass):

if (is_readable('/dev/urandom') && 
     ($fh = @fopen('/dev/urandom', 'rb'))) { 
     $output = fread($fh, $count); 
     fclose($fh); 

线路81-84 register.php(还包括:前两行的要求和$散列器):

require('scripts/PasswordHash.php'); 
$hasher = new PasswordHash(8, false); 
$hash = $hasher->HashPassword($pw); 
if($strlen($hash) < 20){ 
    $notice[] = "Error"; 
} 

那么,这是什么错误呢?

+0

没有解答:

通过抑制错误版本phpass resolves this issue的1.8?没有人知道这个答案吗? –

回答

3

open_basedir限制是PHP中的一项安全措施,基本上限制了对文件系统对特定目录的访问。这对于每个人都只能访问自己的文件的共享环境很有用。默认设置是允许打开所有文件。

在这种情况下,phpass试图访问/dev/urandom,它不包含在允许的目录中,导致错误。修复方法是将您的php.ini中的open_basedir的设置更改为允许/dev/urandom(或允许所有内容)。

Changes since revision 1.7: +2 -2 lines:

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

相关问题