2013-03-02 59 views
2

我不断收到此错误我不断收到一个错误,我的require_once没有指向正确的路径。但它是?

Warning: require_once(../config.php): failed to open stream: No such file or directory in /var/www/busapp/php/register.php on line 11 Fatal error: require_once(): Failed opening required '../config.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/busapp/php/register.php on line 11

这里是我的文件结构的画面

picture of my file structure

register.php文件只是内部php/

和我register.php文件包含require_once('../config.php');

它似乎不是跳上一个文件夹,为什么?

+0

。 ./config.php依次与include_path中的每个条目相关,直到找到....其中第一个条目(。)是当前工作目录,不一定是包含执行include文件的目录 – 2013-03-02 23:29:03

+0

@MarkBaker对不起,我真的不明白你能解释一下好吗? – Xcritic 2013-03-02 23:37:22

+0

当您执行/ relative/include(即不以/开头时),PHP会依次搜索与包含路径中列出的每个目录相关的文件,直到它找到该文件,或者找不到相对于其中任何一个目录 – 2013-03-02 23:58:22

回答

0

看来这里/var/www/busapp/php/register.php你所要求的config.php文件PHP文件夹内,但在现实中,config.php文件是在你的根,所以,你有你的register.php调整Line 11/var/www/busapp/register.php

+0

但第11行说'require_once('../ config.php');'从'register.php'文件直接复制粘贴,它要求用../跳过一个,所以它应该在父文件夹,但它实际上采用../config.php。 – Xcritic 2013-03-02 23:32:29

+0

您应该尝试使用'.'或尝试要求文件的完整路径,它会让您了解如何解决问题 – 2013-03-02 23:37:10

+0

谢谢,出于某种原因添加。而不是..解决我的问题,为什么呢? – Xcritic 2013-03-02 23:42:03

相关问题