[英]Can't find include_path from browser but works in Terminal
我是服務器管理員和PHP的新手,所以我很抱歉。 這個真的讓我卡住了。 我重新啟動了EC2服務器,但仍然沒有運氣。
PHP文件
<?php
require_once "System.php";
var_dump(class_exists('System', false));
?>
終端(工程)
[ec2-user@domU-12-31-39-10-26-22 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
當我通常遇到這些問題時,我只需添加:
require_once(dirname(__FILE__) . '/System.php');
這樣您就可以獲得文件的完整路徑。
但是,你的include_path看起來有點不穩定。 -kc
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.