My problem maybe easy to solve, but I really can’t figure it out.
I followed the instructions in the book “Beginning Zend framework” creating a new project.
The project has 2 controllers ‘account’ and ‘artist’. Here is the tree view of /application:
.
├── application
│ ├── Bootstrap.php
│ ├── configs
│ │ └── application.ini
│ ├── controllers
│ │ ├── AccountController.php
│ │ ├── ArtistController.php
│ │ ├── ErrorController.php
│ │ └── IndexController.php
│ ├── models
│ └── views
│ ├── helpers
│ └── scripts
│ ├── account
│ │ ├── activate.phtml
│ │ ├── index.phtml
│ │ ├── new.phtml
│ │ └── success.phtml
│ ├── artist
│ │ ├── index.phtml
│ │ └── list-all-artists.phtml
│ ├── error
│ │ └── error.phtml
│ └── index
│ └── index.phtml
How can I setup document root to access /account/new.phtml, for example? (When typing 127.0.0.1, I can see the default index page “Welcome to the Zend Framework!”, but I don’t know how to access other pages).
More information:
+) The document root is /…/public/ (which contains .htacess and index.php)
+) 127.0.0.1/index also returns that page, but 127.0.0.1/index/index.phtml does not work.
http://127.0.0.1/account, http://127.0.0.1/artist return 404 error.
Welcome to ZF! A personal thing I do is always setup a Vhost, rather than just use the standard “
localhost“. This really helps with the management of separate projects, and allows you to store it in an easier location.If you try to do localhost/account, what happens? If you get any type of errors, then you haven’t setup Apache properly. Here’s a sample
Vhostthat I use:Go ahead and try to do something similar, and create the respective line in your
HOSTSfile, clear your cache, and you should be set!Also, in your structure, I noticed you’re missing a
publicfolder. Be sure you have one, along with a.htaccessto rewrite toindex.php. Edit: just saw your edit, you should already have this taken care of.