0

在 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 到dir的所有内容。

引发此错误:

警告:require_once(1):无法打开流:第17行的C:\Program Files (x86)\Zend\Apache2\htdocs\index.php中没有这样的文件或目录

致命错误:require_once(): Failed opening required '1' (include_path='.;C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library') in C:\Program Files (x86)\Zend \Apache2\htdocs\index.php17行

  • 脚本在另一台具有完全相同软件的机器上运行良好。
  • 出于测试脚本的目的,即使在同一目录中的 require_once 也不起作用。
  • 改之前备份了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>
4

2 回答 2

0

解决它。需要 htdocs 范围之外的文件的 Windows 权限。

于 2013-07-09T15:26:57.660 回答
0

Apache config IE 中没有使用引号:

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

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

 require_once('C:\www\your_site\outside_http_docs\constants.php');
于 2013-07-08T21:32:21.667 回答