简体   繁体   English

无法从浏览器中找到include_path但在终端中工作

[英]Can't find include_path from browser but works in Terminal

I am new to server admin and PHP so my apologies. 我是服务器管理员和PHP的新手,所以我很抱歉。 This one really has me stuck. 这个真的让我卡住了。 I rebooted the EC2 server but still no luck. 我重新启动了EC2服务器,但仍然没有运气。

PHP File PHP文件

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

Terminal (It Works) 终端(工程)

[ec2-user@domU-12-31-39-10-26-22 current]$ php phpcheck.php
bool(true)

Browser - it doesn't find the file 浏览器 - 它找不到该文件

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

When I typically have these problems, I simply add this: 当我通常遇到这些问题时,我只需添加:

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

That way you get a full path to the file. 这样您就可以获得文件的完整路径。

However, your include_path looks a little wonky. 但是,你的include_path看起来有点不稳定。 -kc -kc

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

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