require_once() [function.require]: 打开 required '/vars.inc' 失败(include_path='.;C:\php5\pear')

发布于 2024-09-26 13:58:45 字数 2423 浏览 1 评论 0原文

我在本地计算机上设置了几个站点 - 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 文件中添加了一行......)。

无论如何,我正在使用 wampserver(最新的)与 PHP 5、Apache 和 mySQL。除非我在尝试加载的文件中使用 require_once 的相对路径,否则该网站加载正常。

我收到以下错误:

警告:require_once(/vars.inc) [function.require-once]:未能 打开流:没有这样的文件或目录 在 C:\HeritageApps\CustomerApp_v2\Customers\Customers.php 第 2 行

致命错误:require_once() [function.require]: 打开失败 必需的“/vars.inc” (include_path='.;C:\php5\pear') 在 C:\HeritageApps\CustomerApp_v2\Customers\Customers.php 第 2 行

据我所知,包含路径 (C:\php5\pear) 不存在,并且我在 php.ini 文件或 httpd.conf 文件中找不到该路径的任何痕迹。我读到路径不存在是引发错误的原因,但我还没有找到任何解决方案。这种情况在过去的一两天里一直在发生,如果某件事长时间不起作用,我往往会感到愤怒和愤怒——所以请有人帮助我解决这个问题吗?我真的不知道出了什么问题或者哪里出了问题......我已经搜索了我能想到的所有。我只需要能够单独更改所有应用程序的包含路径(或者全局更改它将是一个辉煌的开始!!)。

I have several sites setup on my local machine - customerappglobal, customerapp and naturaleigh. I have just one - customerappglobal - working at the moment because thats the only one I need working. I have added the following code to my httpd.conf file:

<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>

This appears to be enough for it to work (oh and a line added in the HOSTS file..).

Anyway I am using wampserver (the latest one) with PHP 5, Apache and mySQL. The site loads fine unless I use a relative path for require_once in the file I am trying to load.

I get the following error:

Warning: require_once(/vars.inc)
[function.require-once]: failed to
open stream: No such file or directory
in
C:\HeritageApps\CustomerApp_v2\Customers\Customers.php
on line 2

Fatal error: require_once()
[function.require]: Failed opening
required '/vars.inc'
(include_path='.;C:\php5\pear') in
C:\HeritageApps\CustomerApp_v2\Customers\Customers.php
on line 2

As far as I know the include path (C:\php5\pear) does not exist and I cannot find any trace of that path in the php.ini file or the httpd.conf files. I have read that the non-existance of the path is why it is throwing the error, but I have not found any solutions. This has been happening for the past day or two and I tend to suffer from the curse of getting wound up and angry if something doesnt work for too long - so please could someone help me with this? I really dont know what is going wrong or where it is going wrong... I have searched everywhere that I can think of. I just need to be able to change the include path for all the applications individually (or changing it globally would be a brilliant start!!).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月光色 2024-10-03 13:58:45

问题在于您的包含:Warning: require_once(/vars.inc),其中/与文件系统根目录相关。您真正想要的是 require_once('./vars.inc');require_once('vars.inc');

The problem is your include: Warning: require_once(/vars.inc), where / relates to the file system root. What you really want is either require_once('./vars.inc'); or require_once('vars.inc');.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文