2012-09-18 30 views
0

工作我新的服务器管理和PHP,所以我的道歉。这一个真的让我卡住了。我重新启动了EC2服务器,但仍然没有运气。无法从浏览器include_path中找到,但在终端

PHP文件

<?php 
require_once "System.php"; 
var_dump(class_exists('System', false)); 
?> 

终端(它工作)

[[email protected] current]$ php phpcheck.php 
bool(true) 

浏览器 - 它没有找到该文件

Warning: require_once(System.php): failed to open stream: No such file or directory in /etc/httpd/opt/app/current/phpcheck.php on line 2 Fatal error: require_once(): Failed opening required 'System.php' (include_path='.:/home/ec2-user/pear/share/pear') in /etc/httpd/opt/app/current/phpcheck.php on line 2 
+0

你确定该文件可以通过服务器用户读取(这可能会或可能不会是你的执行与命令行操作相同的用户)?从命令行执行'ls -al'并查看权限是什么。 – prodigitalson

+0

System.php具有-rw-rw-r--。我如何知道我的web服务器用户是否与我的命令行用户不同? – frankie

+1

我想如果你做一个''<?php phpinfo(); ?>'然后从浏览器访问该文件应该告诉你用户执行PHP程序或者一个运行Apache ...取决于如果PHP运行的CGI/suexec的或作为基本模块。 – prodigitalson

回答

2

当我通常有这些问题,我简单补充一点:

require_once(dirname(__FILE__) . '/System.php');

这样,你得到一个完整的文件路径。

然而,你的include_path看起来有点靠不住。 -kc