We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

home/index - error 500

Hey guys.

I had on the domain a multi-module web made with phalcon, now i changed it to single module, and now my HomeController (that is default) on indexAction give me error 500, mention that only on indexAction, other actions from this controller work perfect, and the indexAction on others controllers works good aswell.

What is the problem?



2.9k

tried and don't work...

post your index controller



2.9k

I don't have IndexController:

I have this route rules:


$router = new Phalcon\Mvc\Router();

$router->removeExtraSlashes(true);

$router->setDefaultController('home');
#$router->setDefaultAction('index');

return $router;

and here is my HomeController


use Phalcon\Mvc\Controller;

class HomeController extends Controller
{

    public function indexAction()
    {
        echo 'Index action!';
    }

    public function testAction()
    {
        echo 'Test action!';
    }
}


2.9k
edited Feb '15

I think so, but i don't know what error, i checked a lot of time htaccess and other files that might display this error.. and no results...



22.8k
edited Feb '15

Hi,

What i suggest is to create a beforeExecuteRoute action on your baseController. This way you can see what controller and action is fired when hitting a route.

Here is some example code :

use Phalcon\Mvc\Controller;
use Phalcon\Mvc\Dispatcher;

class HomeController extends Controller
{

    public function beforeExecuteRoute(Dispatcher $dispatcher)
    {
        $controllerName = $dispatcher->getControllerName();
        $actionName = $dispatcher->getActionName();
        $response = new \Phalcon\Http\Response();
        $request = new \Phalcon\Http\Request();       

        echo $controllerName;
        echo $actioName;
        exit;
    }

    public function indexAction()
    {
        echo 'Index action!';
    }

    public function testAction()
    {
        echo 'Test action!';
    }
}