我在本地机器上设置了几个站点 - customerappglobal,customerapp和naturaleigh。我只有一个 - customerappglobal - 目前正在工作,因为那是我唯一需要工作的人。我已将以下代码添加到我的httpd.conf文件中:
<VirtualHost *:427>
# The name to respond to
ServerName customerappglobal
# Folder where the files live
DocumentRoot "C:/HeritageApps/CustomerApp_v2"
# A few helpful settings...
<Directory "C:/HeritageApps/CustomerApp_v2">
allow from all
order allow,deny
# Enables .htaccess files for this site
AllowOverride All
</Directory>
# Apache will look for these two files, in this order, if no file is specified in the URL
DirectoryIndex index.html index.php
</VirtualHost>
<Directory "c:/HeritageApps">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
#Allow,Deny
Order Deny,Allow
Allow from all
</Directory>
这似乎足以让它起作用(哦,并在HOSTS文件中添加一行......)。
无论如何,我正在使用PHP 5,Apache和mySQL的wampserver(最新版本)。除非我在我试图加载的文件中使用require_once的相对路径,否则网站加载正常。
我收到以下错误:
警告:require_once(/ vars.inc) [function.require-once]:失败了 open stream:没有这样的文件或目录 在 C:\ HeritageApps \ CustomerApp_v2 \ \客户Customers.php 在第2行
致命错误:require_once() [function.require]:打开失败 必需'/vars.inc' (include_path ='。; C:\ php5 \ pear')in C:\ HeritageApps \ CustomerApp_v2 \ \客户Customers.php 在第2行
据我所知,include路径(C:\ php5 \ pear)不存在,我在php.ini文件或httpd.conf文件中找不到该路径的任何跟踪。我已经读过,路径的不存在是它抛出错误的原因,但我没有找到任何解决方案。这种情况在过去的一两天内一直在发生,如果某些事情不能长时间工作,我往往会受到伤害和愤怒的诅咒 - 所以请有人帮助我吗?我真的不知道出了什么问题或出了什么问题......我已经搜索过我能想到的无处不在的。我只需要能够单独更改所有应用程序的包含路径(或者全局更改它将是一个绝佳的开始!)。
答案 0 :(得分:4)
问题是您的include:Warning: require_once(/vars.inc)
,其中/
与文件系统根目录有关。您真正想要的是require_once('./vars.inc');
或require_once('vars.inc');
。