2017-02-15 61 views
1

我遇到了一个问题,包括路径在Apache/ubuntu与PHP 7的瘦应用程序。当我的应用程序/路由索引页尝试包括位于子目录中的文件时,我得到了我的Apache error.log中以下,但路径似乎是正确的对我说:在Slim应用程序中包含Ubuntu的路径PHP警告

PHP Warning: include(myapp/production/include.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 33 
PHP Warning: include(): Failed opening 'myapp/production/include.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/index.php on line 33 

目录结构:在index.php中

/var/www/html/ 
├── index.php 
├── myapp/ 
│ ├── vendor/ 
│ └── production/ 
│  └── include.php 

相关线路33:

include ('myapp/production/include.php'); 

难道会有一些与导致此问题的文件/目录权限有关的东西吗?我很知道在Linux服务器上设置web应用程序;任何帮助表示赞赏。

编辑

我加了一个测试包括在主web目录文件(相同的index.php),以及包括不工作。

+1

是的,你应该检查权限,甚至为了调试的缘故,我会在'index.php'的同一个文件夹中创建'test.php'文件并尝试'包含'它,然后你会发现它是关于权限与否 – smarber

+0

我试过一个包含在web根目录下的测试,它确实有效。 – Marcatectura

+0

然后或者路径错误或者缺少一些权限 – smarber

回答

0

如果我猜测,我怀疑磁盘上目录和文件名的情况与您在PHP代码中使用的不同。

Linux有一个区分大小写的文件系统,因此名为Production的目录与名为production的目录不同。

确保您在include语句中使用的文本与磁盘上的目录和文件的名称完全匹配。

相关问题