2011-12-26 129 views
2

我在Ubuntu 11.10上,并安装了Apache服务器来承载我的本地网站,然后我从公司托管它。Linux/php需要父目录

我的网站根目录为 “/家庭/ a1a4a /网络/”

我在/home/a1a4a/www/account/account_info.php一个PHP文件”

,我想他包括在“/home/a1a4a/www/include/fg_membersite.php”文件

这是我从account_info.php

require_once('./include/fg_membersite.php'); 

没有和我得到这个错误

Warning: require_once(./include/fg_membersite.php): failed to open stream: No such file or directory in /home/a1a4a/www/account/account_info.php on line 10 Fatal error: require_once(): Failed opening required './include/fg_membersite.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/a1a4a/www/account/account_info.php on line 10 

那么我做错了什么?怎么修 。 我有完整的权限(sudo chown -R www-data)。

感谢和节日快乐:)

回答

11

始终使用绝对路径,也将面临因调用脚本错误。

require_once('./include/fg_membersite.php'); 

实际上应该是

require_once(dirname(dirname(__FILE__)).'/include/fg_membersite.php');