Rectangle 27 4

You should modify your .htaccess, i think someone is trying to access some files in hrm folder that don't exist, in this case, the request gets forwarded to your application, which tries to find the hrm module or controller, since it is not there, it throws an error.

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

Will make it not rewrite anything from hrm folder.

RewriteEngine Off

But i assume, you need some rewriting there so this might not be the option!

Sorry for responding late. The hrm folder under public is just a part of the main Zend application. Your extra rule allows only the hrm. But then the main ZF routes which worked earlier fails.

This is a bit hard to understand without actually seeing the structure. But i am guessing, if this fails ,there is no .htaccess within hrm folder, and there should be if i understood the structure right.

The solution didn't actually help directly. But I figured out the Fatal error was actually for some missing asset files. Otherwise, both the ZF app-modules and the hrm app works perfectly. I just was curious why there were errors and app was still functioning properly.

php - “Invalid controller specified” error in zend framework 1 - Stack...

php .htaccess zend-framework mod-rewrite url-rewriting
Rectangle 27 1

No, it remains the same errors.

php - “Invalid controller specified” error in zend framework 1 - Stack...

php .htaccess zend-framework mod-rewrite url-rewriting
Rectangle 27 0

No need to change anything in .htaccess

application.ini change as resources.frontController.baseUrl = "/labs"

Add below function in bootsrap.php and you will be done.

protected function _initBaseUrl()
    {
        $options = $this->getOptions();
        $baseUrl = isset($options['settings']['baseUrl']) 
            ? $options['settings']['baseUrl']
            : null;  // null tells front controller to use autodiscovery, the default
        $this->bootstrap('frontcontroller');
        $front = $this->getResource('frontcontroller');
        $front->setBaseUrl($baseUrl);
    }

php - zend framework redirection issue : Invalid controller specified ...

php mysql .htaccess zend-framework
Rectangle 27 0

<?php

class AuthenticationController extends Zend_Controller_Action {

    public function init() {
        /* Initialize action controller here */
    }

    public function indexAction() {
        // action body
    }

    /**
     * Show login form
     */
    public function loginAction() {

        $this->view->heading = 'Login';
        $this->view->form = new Form_Login();
        $this->view->form->setAction( 'process' );
    }

    /**
     * preDispatch: If user is already logged in then 
     * redirect to index, if not then redirect to login
     */
    public function preDispatch() {

        if (Zend_Auth::getInstance()->hasIdentity()) {
            // If the user is logged in, we don't want to show the login form;
            // however, the logout action should still be available
            if ('logout' != $this->getRequest()->getActionName()) {
                $this->_helper->redirector('index', 'index');
            }
        } else {
            // If they aren't, they can't logout, so that action should 
            // redirect to the login form
            if ('logout' == $this->getRequest()->getActionName()) {
                $this->_helper->redirector('login');
            }
        }
    }

    /**
     * Provide authentication adapter
     * 
     * @param unknown_type $values
     */
    public function getAuthAdapter( $values ) {

        $authAdapter = new Zend_Auth_Adapter_DbTable( Zend_Db_Table::getDefaultAdapter(),
                                                      'Authentication',
                                                      'username',
                                                      'password',
                                                      'MD5(CONCAT(salt,?))'
                                                    );

        $authAdapter->setIdentity( $values['username'] );
        $authAdapter->setCredential( $values['password'] );                                         

        return $authAdapter;
    }

    /**
     * Process login request. If user is authenticated
     * then redirect to index otherwise show login form again
     */
    public function processAction() {

        $request = $this->getRequest();

        // Check if we have a POST request
        if (!$request->isPost()) {
            return $this->_helper->redirector('login');
        }

        // Get our form and validate it
        $form = new Form_Login();
        if (!$form->isValid($request->getPost())) {
            // Invalid entries
            $this->view->form = $form;
            return $this->render('login'); // re-render the login form
        }

        // Get login form values
        $values = $form->getValues();

        // Get our authentication adapter and check credentials
        $adapter = $this->getAuthAdapter( $values );
        $auth    = Zend_Auth::getInstance();
        $result  = $auth->authenticate($adapter);

        if (!$result->isValid()) {
            // Invalid credentials
            $form->setDescription('Invalid credentials provided');
            $this->view->form = $form;
            $this->_helper->redirector('login'); // re-render the login form
        }

        // Create session
        $session = new Zend_Session_Namespace('user');
        $session->userEmail = $values['username'];
        $session->userId = '1';

        // We're authenticated! Redirect to the home page
        $this->_helper->redirector('index', 'index');
    }

    /**
     * logout request
     */
    public function logoutAction() {

        // Destroy session
        $session = new Zend_Session_Namespace('user');
        $session->userEmail = null;
        $session->userId = null;

        Zend_Auth::getInstance()->clearIdentity();
        $this->_helper->redirector('login'); // back to login page
    }


} // end class


?>

php - How to get authentication adapter in zend? - Stack Overflow

php zend-framework authentication
Rectangle 27 0

Seems like you have invalid include_path

define('ROOTDIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
define('LIBDIR', realpath(ROOTDIR . '../library') . DIRECTORY_SEPARATOR);
set_include_path(implode(PATH_SEPARATOR, array_merge(explode(PATH_SEPARATOR,ini_get('include_path')), array(LIBDIR))));

php - Zend framework controller action helper - Stack Overflow

php zend-controller
Rectangle 27 0

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

If you don't have the first 4 lines, this file will redirect your request of "css/layout.css" to index.php and then, Zend will interpret it as a link for a controller -> action.

If you have this file, make sure that mod_rewrite is enabled on your server.

And you sould put your link as "akond" said.

.htaccess file contains the above lines and rewrite module is enabled on server also as in httpd.conf I have uncommented the line LoadModule rewrite_module modules/mod_rewrite.so But still same problem.

Can you access the css file with a direct link? Example: mydomain.com/css/layout.css? Or does it returns the same thing that firebug reports?

php - Invalid controller specified (css) in Zend framework - Stack Ove...

php css zend-framework
Rectangle 27 0

Ok, just added the following line to my .htaccess file and all works as expected now...

RewriteRule !.(js|ico|txt|gif|jpg|png|css|htc|swf|htm)$ index.php

php - Invalid controller specified (css) in Zend framework - Stack Ove...

php css zend-framework
Rectangle 27 0

You should modify your .htaccess, i think someone is trying to access some files in hrm folder that don't exist, in this case, the request gets forwarded to your application, which tries to find the hrm module or controller, since it is not there, it throws an error.

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

Will make it not rewrite anything from hrm folder.

RewriteEngine Off

But i assume, you need some rewriting there so this might not be the option!

Sorry for responding late. The hrm folder under public is just a part of the main Zend application. Your extra rule allows only the hrm. But then the main ZF routes which worked earlier fails.

This is a bit hard to understand without actually seeing the structure. But i am guessing, if this fails ,there is no .htaccess within hrm folder, and there should be if i understood the structure right.

The solution didn't actually help directly. But I figured out the Fatal error was actually for some missing asset files. Otherwise, both the ZF app-modules and the hrm app works perfectly. I just was curious why there were errors and app was still functioning properly.

php - “Invalid controller specified” error in zend framework 1 - Stack...

php .htaccess zend-framework mod-rewrite url-rewriting
Rectangle 27 0

try in your application.ini:

resources.frontController.moduleControllerDirectoryName = "controllers"
resources.frontController.params.prefixDefaultModule = ""
<?php

class Admin_Bootstrap extends Zend_Application_Module_Bootstrap {
    //put your code here
}

php - Zend Framework - "Invalid controller specified" - Stack Overflow

php zend-framework
Rectangle 27 0

I have answered a similar question before using a custom plugin here.

Basically, it checks if a request can be dispatched and in the event it cannot, it redirects to another controller/action. This happens before the ErrorHandler plugin allowing for the ErrorHandler to handle errors only as intended.

I should note that inn the plugin on the linked question, I referenced the username. In your case, you will have to substitute slug for username.

php - handle invalid controller explicitly in Zend framework - Stack O...

php zend-framework
Rectangle 27 0

Maybe you have to change your "baseUrl" in your config file.

resources.frontController.baseUrl = "/labs/"

did, even not working

it looks you have to change your config file and your htaccess : blog.digitalpierce.com/2012/08/24/ resources.frontController.baseUrl = "/labs" And add in your htaccess "RewriteBase /labs"

php - zend framework redirection issue : Invalid controller specified ...

php mysql .htaccess zend-framework
Rectangle 27 0

In your admin module folder, check that IndexController.php exists within the "controllers" sub-directory.

If it does, then open IndexController.php and ensure that the class declaration does indeed declare the class "IndexController" (a common copy+paste pitfall)

Everything in controller is fine, it exists, name is "class Admin_IndexController".

And the file name is indexController.php, the application works alright on localhost, so the problem will be in paths probably or some configuration.

Class name should be IndexController, not Admin_IndexController.

The filename should be IndexController.php (note the first capital). On windows it works. On Unix is the file system case sensitive and therefore it fails.

php - Zend Framework - "Invalid controller specified" - Stack Overflow

php zend-framework
Rectangle 27 0

You should rely on the resource loader/bootstrap to get your frontController, drop the _initController()

$this->bootstrap('frontController');
$frontController = $this->getResource('frontController');

As far as the error goes, I think your problem might be the missing slash on: APPLICATION_PATH . '/controllers/' that you are manually setting in the bootstrap. Your APPLICATION_PATH might not end with a /, therefore it can't find applicationcontrollers/ErrorController.php

Also, your _initRoute() function could be replaced with the following application.ini:

resources.router.routes.default.type = "Zend_Controller_Router_Route"
resources.router.routes.default.route = ":controller/:action/*"
resources.router.routes.default.defaults.controller = "index"
resources.router.routes.default.defaults.action = "index"
resources.router.routes.default.defaults.module = "default"

This leaves the only part of your bootstrap that wants the controller the run() function's try{}catch{} which could be moved to your index.php instead.

php - Invalid controller specified (error) - Zend Framework - Stack Ov...

php zend-framework
Rectangle 27 0

RewriteBase /psm/CB11011

into your .htaccess file, where psm/CB11011 is the subdirectory you moved the application to.

php - error invalid controller specified in zend framework after uploa...

php zend-framework controller hosting
Rectangle 27 0

It sounds to me like the request for your js code is being rewritten through your Zend Framework bootstrap? In your .htaccess file you may want to add an entry to not specific url patterns to the Zend Framework application. Here's generally what I do:

RewriteEngine on
RewriteRule       ^images.*$      - [L]
RewriteRule       ^img.*$         - [L]
RewriteRule       ^js.*$          - [L]
RewriteRule !\.(js|ico|gif|jpg|png|css|pdf|doc|xls|csv|txt)$ index.php

php - Zend Framework Strange Errors Invalid Controller with part of ja...

php javascript jquery-ui zend-framework
Rectangle 27 0

The problem is that your application is in an subfolder in your hosting environment. This way zend thinks (with this call http://172.20.30.43/psm/CB11011/) that it should access the controller psm and call the action CB11011. Simply change your .htaccess file inside you /public directory.

RewriteEngine on
RewriteRule (.*) ./psm/CB11011/$1

And change the path to the frontcontroller inside your application.ini:

resources.frontController.baseUrl = "/psm/CB11011"

PS: There a some security concerns about putting the whole application into a subfolder, since your controller/modules might be accessible!

Not working. i try to modified like this.. RewriteRule (.*) ./172.20.30.43psm/CB11011/$1 ..but also not working..

have you set a correct baseurl to your frontcontroller? see my edit

have improvement, but it capture wrong controller.. Invalid controller specified (carrental)..

php - error invalid controller specified in zend framework after uploa...

php zend-framework controller hosting
Rectangle 27 0

No, it remains the same errors.

php - “Invalid controller specified” error in zend framework 1 - Stack...

php .htaccess zend-framework mod-rewrite url-rewriting
Rectangle 27 0

I was using an authetication controller my collegue prepared and I had the same problem, and I found the problem in the redirect of the controller.

if (!$this->_acl->isAllowed(Zend_Registry::get('user_role'), $module . ':' . $controller, $action)) {
$request->setModuleName('default')->setControllerName('authentication')->setActionName('login');}

This basically checkes if you are logged in and if you have the access rights to go to the specified controller, and if not, it redirects you to (in this case) default/authenticaion/index Unfortunately the redirect parameters are not displayed in the error message. I realized I do not have the controller I am redirecting to ready, so in some cases it might be the same problem.

php - Zend Framework - "Invalid controller specified" - Stack Overflow

php zend-framework
Rectangle 27 0

Zend_Controller_Plugin_ErrorHandler can handle the exception due to missing controller/action and is enabled by default. You can put your logic inside.

php - handle invalid controller explicitly in Zend framework - Stack O...

php zend-framework