user3392695
user3392695

Reputation: 21

Zend FrameWork 2 Album tutorial Error : A 404 error occurred Page not found

I am following the below tutorial to implement the [skeleton application][1].

I have copy-pasted all the code provided in the tutorial, but I am getting the below error:

A 404 error occurred

Page not found.

The requested URL could not be matched by routing.

No Exception available

I have cross checked all the similar issues in StackOverflow, but none of them were able to solve my issue.

Can some one help me in this?

Please find the below code.:

C:\wamp64\www\zend\module\Album\Module.php

<?php

namespace Album;

use Album\Model\AlbumTable;

class Module
{
    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\ClassMapAutoloader' => array(
                __DIR__ . '/autoload_classmap.php',
            ),
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

    public function getServiceConfig()
    {
        return array(
            'factories' => array(
                'Album\Model\AlbumTable' =>  function($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $table = new AlbumTable($dbAdapter);
                    return $table;
                },
            ),
        );
    }    

    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }
}

C:\wamp64\www\zend\module\Album\config\module.config.php

<?php
return array(
    'controllers' => array(
        'invokables' => array(
            'Album\Controller\Album' => 'Album\Controller\AlbumController',
        ),
    ),

    'router' => array(
        'routes' => array(
            'album' => array(
                'type'    => 'segment',
                'options' => array(
                    'route'    => '/album[/:action][/:id]',
                    'constraints' => array(
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'id'     => '[0-9]+',
                    ),
                    'defaults' => array(
                        'controller' => 'Album\Controller\Album',
                        'action'     => 'index',
                    ),
                ),
            ),
        ),
    ),

    'view_manager' => array(
        'template_path_stack' => array(
            'album' => __DIR__ . '/../view',
        ),
    ),
);

Is there a way in zend to do a debug on where the issue is occurring?

.htaccess file includes the below code

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

vhost is as below

<VirtualHost *:80>
    ServerName zend
    DocumentRoot c:/wamp64/www/zend/public
    <Directory  "c:/wamp64/www/zend/public/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

host is setup as

127.0.0.1       zend

I am trying to access the link as below

http://zend/album

C:\wamp64\www\zend\config\modules.config.php

return [
    'Zend\Router',
    'Zend\Validator',
    'Application',
    'Album',
];

Upvotes: 0

Views: 1721

Answers (1)

user3392695
user3392695

Reputation: 21

It was because of cache.

Just disabled the below in C:\wamp64\www\zend\config\application.config.php

'config_cache_enabled' => false,
'module_map_cache_enabled' => false

Upvotes: 2

Related Questions