在我的/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错误日志中看到上述错误。
非常感谢任何帮助。
FYI:/ 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/>";
?>
第一个&#34; WTF&#34;和&#34; $ _ SERVER [&#39; DOCUMENT_ROOT&#39;]&#34;得到发布就好了。然后,在我的phpass.php页面上没有显示任何其他内容,当我进入我的nginx错误日志文件时,我看到此帖子顶部显示的错误。
答案 0 :(得分:0)
这是我的问题的答案:require_once () or die() not working
显然在我的require_once命令的末尾添加“或die('text')”是我的垮台。