编辑httpd.conf - 要求/包含不再有效

时间:2013-07-08 21:28:48

标签: php apache

在Windows 7x64上运行最新的Zend Server,我正在使用不同的方法将htdoc同步到dropbox并编辑两行httpd.conf。

DocumentRoot "C:\Program Files (x86)\Zend\Apache2/htdocs"

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

包含各种符号链接,保管箱位置等

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

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

require_once('constants.php');

(在用于故障排除的同一目录中,尝试了从$ _SERVER到目录的所有内容。

引发此错误:

警告:require_once(1):无法打开流: C:\ Program Files(x86)\ Zend \ Apache2 \ htdocs \ index.php <中没有此类文件或目录/ strong>在线 17

致命错误:require_once():无法打开所需的'1'(include_path ='。; C:\ Program Files(x86)\ Zend \ ZendServer \ share \ ZendFramework \ library') C:\ Program Files(x86)\ Zend \ Apache2 \ htdocs \ index.php 在线 17

  • 脚本在另一台具有完全相同软件的计算机上正常工作。
  • 出于测试脚本的目的,即使同一目录中的require_once也不起作用。
  • 在更改之前备份httpd.conf,将其恢复无效。
  • 将健康机器上的httpd.conf复制,没有变化。
  • 完全重新安装整个zend包两次,没有变化。

不知道是什么导致了这一点。有什么想法吗?


这是健康机器的开箱即用,#removed:

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>

2 个答案:

答案 0 :(得分:0)

Apache config IE中没有使用引号:

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

此外,您的include可能需要绝对路径,具体取决于您的Apache设置.. IE

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

答案 1 :(得分:0)

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