【发布时间】:2018-04-09 12:50:59
【问题描述】:
我在我的 ubuntu 16.04 操作系统上本地运行灯堆栈,并且在包含文件时遇到问题。我在 index.php 中的代码:<?php include('steamauth/steamauth.php'); ?>
<?php include('steamauth/userinfo.php');?>
我的结构是:
index.php
steamauth
steamauth.php
userinfo.php
我收到以下错误:
包括(steamauth/userinfo.php):无法打开流:/var/www/html/index.php 中没有这样的文件或目录
include():在 /var/www/html/index.php
中打开 'steamauth/userinfo.php' 以包含 (include_path='.:/usr/share/php') 失败
我尝试使用完整路径,在路径前添加 webroot,更改 php.ini 中的 include_path,但似乎没有任何效果。我该怎么办?
【问题讨论】:
-
为了测试您的包含没有问题,您可以尝试将包含文件放在与 index.php 相同的文件夹中,并将包含更改为 'steamauth.php' 和 'userinfo .php'?让我知道这是否有效?
-
如果可行,请将文件放回 steamauth 并将包含更改为 "{$_SERVER[DOCUMENT_ROOT]}/steamauth/steamauth.php" 和 "{$_SERVER[DOCUMENT_ROOT]}/steamauth/用户信息.php”。注意:您必须将单引号更改为双引号才能对此进行测试。让我知道这是否有效。
-
接下来,在 steamauth 文件夹中创建一个测试文件 "index.php" 并简单地将 " 放入其中。然后尝试加载 [your domain]/steamauth /index.php 在您的浏览器中。页面是否加载?
-
这似乎也与您 2 天前的问题重复(有一些小改动)。下次您应该为现有问题添加更多详细信息,而不是再次创建问题。
-
问题是我还有 1 个我没有提到的名为 navbar.php 的文件,我可以包含它没问题。我什至可以访问您所写的 steamauth 文件夹中的 index.php。但我不能包含这两个文件:userinfo.php 和 steamauth.php,尽管它们与其他文件具有相同的权限。有什么想法吗?
标签: php apache server include require