Unable to call Index controller's actions

Hi everyone. I have a simple project in my xampp/htdocs directory called phalcon and i have apache configured to point to that folder so that i can go to phalcon/ in my browser. The problem occurs when I try to open an index controller view other than index(default). For instance I have someAction in Index controller and in views/index I have some.phtml. If I go to phalcon/index/some I don't get the text from some.phtml outputed to the page. It's probably because it thinks as if I wan't to open IndexController->indexAction and pass some as a parameter. Would be grateful on any help provided to resolve this. P.S. the project skeleton was copied from https://github.com/phalcon/skeleton-single

edited Apr '14

Do you get no output at all?

If you call


from your someAction method, do you get anything?

Can you post the code for your controller?


No, if I go to phalcon/index/some and I have exit('test') in some action nothing gets displayed. Here is a project folder.Here is a link : https://www.dropbox.com/s/b5tbdqq7l0i9fx1/phalcon.7z

Please just copy & paste your controller code here - so others that may be having this problem in the future can also maybe benefit. Please read: http://forum.phalconphp.com/help/markdown for how to display code.

In your bootstrap file, do a dump of $_SERVER, to see what the requested URL actually is. It's possible your URL rewrites aren't working.

edited Apr '14

Index controller:


    class IndexController extends ControllerBase

        public function indexAction($action = null)

      public function someAction () {


views/index/index.phtml :

        <?php echo $this->getContent(); ?>


Some Action


   <!DOCTYPE html>
        <title>Phalcon PHP Framework</title>
        <?php echo $this->getContent(); ?>
edited Apr '14

Is ControllerBase setting something in the view? I don't personally use getContent() so I'm not really familiar with how it works.

I believe you can set a beforeDispatch handler and output the controller and action that Phalcon has determined to use.


What do you use instead of getContent?


Controller Base is empty in only extends Phalcon/Mvc/Controller


Controller Base is empty in only extends Phalcon/Mvc/Controller

Nothing - I just use Volt syntax, and don't have any inherited templates. So my view/index.phtml file would look something like:

{{ partial('partials/head.phtml') }}
Content specific to this page
{{ partial('partials/foot.phtml') }}

There's nothing wrong with using getContent() - it may even be superior to my method.


If I go to any other controller that I created and any other action everything displays correctly. Maybe it has something to do with my base uri? I have it set to 'http://phalcon/'

I'm not so sure. I believe that URL component just has to do with generating URLs in the view - it isn't a system wide setting.

I just re-read your initial post and I think I know what the problem is. By default, a Phalcon URL will have a controller component, and an action component, like: www.mydomain.com/book/buy.

The index controller is only called when the URL has no controller or action component, like: www.mydomain.com/. Other actions in the index controller - like your some won't ever get accessed because what would the URL to them look like: www.mydomain.com//some? That's a nonsensical URL.

If you want your some action to be called, like with this URL: www.domain.com/some, then you should put that code in a someController in the indexAction method.


Ok. Thanks, but isn't IndexController get called when you explicitly call it like for instance www.domain.com/index/actionName ?

I don't know. Honestly I've never tried that. If all of your other controllers and actions are working except non-index actions on the index controller, then I would hazard to guess not.


Here, I have asked a same question a couple days ago and I guy said me that everything worked at his project and posted these photos : http://vk.com/topic-45934290%528737621?z=photo-45934290%5327264411%2Fpost-45934290%5642


edited Apr '14

Oh. Well evidently I'm not familiar enough with this to be of much help.


Ok. Thank you for everything you've done anyway)


@angay9 HI!

Let's go to the file file/config/config.php as here https://github.com/phalcon/skeleton-single/blob/master/app/config/config.php

There is this config array here. The last element of the array is baseUri. Have you modyfied it? I think this might be a case. I am not sure what the value you should have but definitly not /single-skeleton/. I think it shoul be / but i am not sure. Maybe /phalcon/? Or maybe in your case this element should be deleted at all?


I have changed but I have tried different variants including default one and it still doesn't work.

Try to place die(); in IndexController

class IndexController extends ControllerBase {

public function indexAction()
    echo "<h1>Hello</h1>";


php is parsing through the controller but in the last because of the view the ouput shows you the view only.

edited Dec '14


Using the Phalcon Tools I have created an app. No problems. Created some controllers and models and views and everything works as expected except accessing the indexController's methods. Sorry to dig up an old thread, but did you ever find the solution ?

If I use the following request specifying the paramater name:


everything works. Whereas :


does not. Like you this does work :


I cannot see anything to cause a redirect route. If you know any more or anyone else can shed light, it would be appreciated.

edited Dec '14

I dumped the $_SERVER var from public/index.php and noticed differences from the successful test route and the failing index route.

The successful one showed:


[QUERY_STRING] => _url=/test/metho/argname

[PHP_SELF] => /index.php

The failed index route had no [REDIRECTSTATUS] and [QUERYSTRING] => ( empty )

It also showed :

[PATH_TRANSLATED] => redirect:/index.php/argname

[PHP_SELF] => /index.php/metho/argname

So off to apache and check the VirtualHost.

I added Options All as per the documentation :


And success. IndexController methods are called.

My Apache httpd.conf sets Options to :

Options FollowSymLinks Multiviews

Options All - enables all settings other than MultiViews. Removing MulltiViews would, if you did not have a VirtualHost Directory entry, also work.

Further, if you disable all Options settings other than FollowSymLinks, all works. So this in your Phalcon VirtualHost Directory works :

Options +FollowSymLinks -ExecCGI -Includes -IncludesNOEXEC -Indexes -MultiViews -SymLinksIfOwnerMatch

but may not be what you want.

I was remiss in not reading the docs (again ?). Anyhow, I hope this helps someone.