繁体   English   中英

使用Nginx和php5-fpm在ubuntu 12.10上包含PHP文件的问题

[英]Trouble including PHP file on ubuntu 12.10 using nginx and php5-fpm

在寻找对我的/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错误日志文件时,看到的错误显示在本文的顶部。

这是我的问题的答案: require_once()或die()不起作用

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM