2011-03-14 78 views
3

我是zend框架应用程序的新手。我通过它的源代码示例在线获得了一本书,我正在努力学习有关zend framework mvc的知识。我在wamp中提取了www中的示例文件夹。当我试图访问应用程序localhost/exampleMVC /我得到一个页面,该目录中的所有文件夹除了公共,该应该可用于服务器,当我尝试访问它localhost/exampleMVC/public我得到一个错误页面错误500;内部服务器错误。无法在WAMP上运行zend框架MVC应用程序

我想念什么!?

感谢

回答

8

只是你错过了,使mod_rewrite解决它去

WAMP -> APACHE -> apache modules -> then click on the mod rewrite 

,你会发现,阿帕奇重启本身 ,你是好去

我做了截屏约zf + wamp安装前2年内,欢迎您收看 http://www.zendcasts.com/getting-started-with-zend-and-wamp-server/2009/06/

+0

这工作,请你告诉我为什么? – Phil 2012-04-14 07:30:40

+0

国防部重写被禁用,就是这样:)轻松通过 – tawfekov 2012-04-14 09:57:04

+0

我的意思是,为什么mod重写未经检查禁止我看到该网站或公共文件夹? – Phil 2012-04-14 14:03:52

1

你需要在Apache的配置virtual-host使Zend的正常工作与mode_rewrite

wamp\bin\apache\Apache(version number)\conf\httpd.conf删除#符号线Include conf/extra/httpd-vhosts.conf前(只是线下# Virtual hosts附近配置文件的末尾)

然后在文件中应该有类似的东西:

# 
# Virtual Hosts 
# 
# If you want to maintain multiple domains/hostnames on your 
# machine you can setup VirtualHost containers for them. Most configurations 
# use only name-based virtual hosts so the server doesn't need to worry about 
# IP addresses. This is indicated by the asterisks in the directives below. 
# 
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/> 
# for further details before you try to setup virtual hosts. 
# 
# You may use the command line option '-S' to verify your virtual host 
# configuration. 

# 
# Use name-based virtual hosting. 
# 
#NameVirtualHost *:80 

# 
# VirtualHost example: 
# Almost any Apache directive may go into a VirtualHost container. 
# The first VirtualHost section is used for all requests that do not 
# match a ServerName or ServerAlias in any <VirtualHost> block. 
# 

nameVirtualHost localhost 
<VirtualHost 127.0.0.1> 
    ServerAdmin [email protected] 
    DocumentRoot "c:/wamp/www" 
    ServerName localhost 
    ErrorLog "logs/localhost-error.log" 
    CustomLog "logs/localhost-access.log" common 
</VirtualHost> 

在此之后,添加新的虚拟主机,这样的事情:

<VirtualHost 127.0.0.1> 
    ServerAdmin [email protected] 
    DocumentRoot "C:\wamp\www\zendProject\public\" 
    ServerName zendProject.local 
    ErrorLog "logs/zendProject.local-error.log" 
    CustomLog "logs/zendProject.local-access.log" common 
    <directory "C:\wamp\www\zendProject\public\"> 
     Options Indexes FollowSymLinks 
     AllowOverride all 
     Order Deny,Allow 
     Deny from all 
     Allow from 127.0.0.1 
    </directory> 
</VirtualHost> 

确保将您的实际zend项目名称替换zendProject。我personnaly添加.local作为域扩展名,这样我就不会覆盖Web上的真实域。

最后使它工作,你需要编辑您的主机文件,它的位置应该有:C:\Windows\System32\drivers\etc\hosts

,你只需要在文件以下行(在记事本中打开它)的末尾添加:

127.0.0.1  zendProject.local 

确保使用您在虚拟主机配置中设置的名称。

重新启动你的Wamp服务器,你很好走