Javacadabra
Javacadabra

Reputation: 5768

Trying to get started with Zend Framework 1.12.7

Hi guys I am having a lot of trouble getting started with Zend Framework 1.12. Basically I've managed to get my project set up in Netbeans and I have it located on my localhost. When I go to this URL I get the default page:

http://localhost/zendtest2/application/views/scripts/index/index.phtml

But when I go to this page I get a list of my file tree in the localhost directory

http://localhost/zendtest2/

I guess what I am trying to understand is how to I get the http://localhost/zendtest2/ to point to the http://localhost/zendtest2/application/views/scripts/index/index.phtml or is that how I would even do it?

I know there is a public folder in my project with an index.php file. Is there some way that I should be reaching that page when the project initially starts?

Upvotes: 0

Views: 127

Answers (1)

StevieJayCee
StevieJayCee

Reputation: 114

To me this sounds more like an environment issue rather than a zend framework issue. I am not entirely sure what your dev environment is, but I am going to assume you're using apache as your HTTP server:

https://wiki.apache.org/httpd/DirectoryListings

Again, I am not entirely sure what OS you're using so you'll need to find your httpd.conf file yourself.

You then have two options, adding the redirect/route there (that may be wrong) or (more recommended) uncommenting the httpd-vhosts.conf link:

# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf

Then including the new route in there. Heres a basic example (again you'll need to add what you need):

<VirtualHost *:8888>
    ServerName zf2-tutorial.localhost
    DocumentRoot "/Users/stevenc/****DIR_STUFF****/skeleton-application/public"
</VirtualHost>

Anything beyond that can be set as your home route in the module.config.php of the Application module within your zend project:

'router' => array(
    'routes' => array(
        'home' => array(
            'type' => 'Zend\Mvc\Router\Http\Literal',
            'options' => array(
                'route'    => '/',
                'defaults' => array(
                    'controller' => 'BookList\Controller\Book',
                    'action'     => 'index',
                ),
            ),
        ),

Also, if you're not using ZF 1.12 for any particular reason, ZF2.3* is the latest.

Upvotes: 2

Related Questions