编辑httpd.conf-Require/include不再有效


Edit httpd.conf - Require/include no longer works

在Windows 7x64上运行最新的Zend Server时,我尝试了不同的方法将htdocs同步到dropbox中,并编辑了两行httpd.conf.

DocumentRoot "C:'Program Files (x86)'Zend'Apache2/htdocs"
<Directory "C:'Program Files (x86)'Zend'Apache2/htdocs">

具有各种符号链接、投递箱位置等

把它放回原来的样子,php包含并不再需要工作。我知道这些脚本很好,因为完全相同的脚本在我的桌面上使用完全相同的开发环境。

我将所有的用户名/密码/数据库名称等放在一个php文件中,该文件通常存储在htdocs目录之外。

require_once('constants.php');

(为了进行故障排除,在同一目录中,已尝试从$_SERVER到目录的所有操作。

抛出此错误:

警告:require_one(1):无法打开流:在C:''Program Files(x86)''Zend''Apache2''htdocs''index.php17行中没有这样的文件或目录

致命错误:requireonce

  • 脚本在另一台使用完全相同软件的机器上运行良好
  • 为了测试脚本,即使在同一目录中require_one也不起作用
  • 在更改之前对httpd.conf进行了备份,并将其放回,但没有任何效果
  • 已从正常计算机上复制httpd.conf,没有更改
  • 完整地重新安装了整个zend软件包两次,没有任何变化

不知道是什么原因造成的。有什么想法吗?


这是开箱即用的健康机器,#已删除:

DocumentRoot "C:'Program Files (x86)'Zend'Apache2/htdocs"
Each directory to which Apache has access can be configured with respect
to which services and features are allowed and/or disabled in that
directory (and its subdirectories). 
First, we configure the "default" to be a very restrictive set of 
features.  
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
Note that from this point forward you must specifically allow
particular features to be enabled - so if something's not working as
you might expect, make sure that you have specifically enabled it
below.

This should be changed to whatever you set DocumentRoot to.
<Directory "C:'Program Files (x86)'Zend'Apache2/htdocs">
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 None
Controls who can get stuff from this server.
Order allow,deny
Allow from all
</Directory>

Apache配置IE:中不使用引号

   ServerName yoursite.com
   DocumentRoot C:'www'your_site
   <Directory C:'www'your_site>
            Options FollowSymLinks MultiViews
            ... rest of stuff
   </Directory>

此外,根据您的Apache设置,您的include可能需要绝对路径。。IE

 require_once('C:'www'your_site'outside_http_docs'constants.php');

修复了它。Windows权限要求文件超出htdocs的范围。