Can't run zend framework MVC application on WAMP

≯℡__Kan透↙ 提交于 2020-01-04 03:17:50

问题


I am new to zend framework application. I got a book online with it's source code example and I'm trying to work on in to learn about zend framework mvc. I extracted the example folder in www in wamp. When I try to reach the application localhost/exampleMVC/ I get a page with all folders in that directory except for the public, the one should be available for the server and when I try to access it localhost/exampleMVC/public I get an error page Error 500; internal server error.

what do I miss!?

thanks


回答1:


simply you missed to enable mod_rewrite to solve it go to

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

you would notice that apache restart itself and you be good to go

i did a screencast about zf + wamp setup before 2 years , you are welcome to watch it http://www.zendcasts.com/getting-started-with-zend-and-wamp-server/2009/06/




回答2:


You need to configure a virtual-host in apache to make zend work properly with mode_rewrite

in your wamp\bin\apache\Apache(version number)\conf\httpd.conf remove the # symbol in front of the line Include conf/extra/httpd-vhosts.conf (just under the line # Virtual hosts near the end of the config file)

Then in the file wamp\bin\apache\Apache(version number)\conf\extra\httpd-vhosts.conf there should be something like that :

#
# 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 webmaster@localhost
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" common
</VirtualHost>

after this, add your new virtual host, something like that :

<VirtualHost 127.0.0.1>
    ServerAdmin webmaster@localhost
    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>

make sure to replace zendProject by your actual zend project name. I personnaly add the .local as the domain extension, this way I wont override a real domain on the Web.

And finally to make it work you need to edit your host file, which should be located there : C:\Windows\System32\drivers\etc\hosts

you just have to add at the end of the file the following line (open it in notepad) :

127.0.0.1       zendProject.local 

make sure to use the same name that you've setted in your virtual host configs.

Restart your Wamp server and you are good to go



来源:https://stackoverflow.com/questions/5298112/cant-run-zend-framework-mvc-application-on-wamp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!