0

寻求帮助解决在我的 /var/log/nginx/error.log 文件中发现的以下 PHP 包含错误?

2013/04/16 22:27:18 [error] 10021#0: *6 FastCGI sent in stderr: "PHP message: PHP Warning:  require(1): failed to open stream: No such file or directory in /usr/share/nginx/www/phpass.php on line 8
PHP message: PHP Fatal error:  require(): Failed opening required '1' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/nginx/www/phpass.php on line 8" while reading response header from upstream, client: 127.0.0.1, server: 127.0.0.1, request: "GET /phpass.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "xxxxxxxxx.xxx"

我可以通过我的浏览器看到有问题的 php 文件(phpass.php,它只是一个示例 phpass 脚本),并且肯定会解析 php,但是当我包含 PasswordHash.php 时,我的 php 脚本会默默地失败,并且我一直看到上述错误在我的 nginx 错误日志中。

任何帮助将不胜感激。

仅供参考:/bin/echo $PATH 返回:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

我从下面粘贴了包含 PasswordHash.php 的示例脚本:

<?php

echo "WTF";

echo $_SERVER['DOCUMENT_ROOT'];

//require("/usr/share/nginx/www/includes/phpass-0.3/PasswordHash.php") or die("shit");
//require("includes/phpass-0.3/PasswordHash.php") or die("shit");
require_once("PasswordHash.php") or die("shit");

echo "WTF";

$pwdHasher = new PasswordHash(8, FALSE);

echo "WTF";

$password = "password";

//$hash is what you would store in your database
$hash = $pwdHasher->HashPassword($password);

//$hash would be the $hashed stored in your database for this user
$checked = $pwdHasher->CheckPassword($password, $hash);
if ($checked) {
    echo 'password correct\n\n<br/>';
} else {
    echo 'wrong credentials\n\n<br/>';
}

echo "The \$password is 'password' and it's hash is '$hash'\n\n<br/>";

?>

第一个“WTF”和“$_SERVER['DOCUMENT_ROOT']”发布得很好。之后,我的 phpass.php 页面上没有显示任何其他内容,当我进入我的 nginx 错误日志文件时,我看到了这篇文章顶部显示的错误。

4

1 回答 1

0

这是我的问题的答案:require_once () or die() not working

显然,在我的 require_once 命令末尾添加“或死('text')”是我的失败。

于 2013-04-17T00:26:02.887 回答