2011-03-14 76 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服務器,你很好走