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

View directories are both case-sensitive and case-insensitive

Everything worked fine locallly (on WAMP) but when I moved to a production server (Amazon Linux) the capitilisation of certain directories became important.

My main views directory is app/views and on the production server the directories inside there have to be non-capitalised - so the path to a view is like app/views/products/index.volt. However, some of my controllers set their views directory to app/extensions/security/views and these must be capitalised as app/extensions/security/views/Users/index.volt in order for the view to be found.

On my local server the case doesn't matter.

It looks like something similar to the problem in this question.

Why do some of the directories require capitalisation and some do not? I don't mind capitalising directories but it would be useful for it to be consistent across all of them.

edited Aug '15

As far as I understand, the controller directories of views are lower case - I'm on debian, and my controller view folders are lowercase. Have you messed with any of the controller/action name generation in the router? I also assume you're aware that win is case insesitive while unix systems are not, just mentioning ;]

I have two different namespaces with controllers in - one is Me\Controllers and the other is Me\Security\Controllers. The default namespace is the first one, for which it wants lowercase directory names. The second I specify in the router

<?php
    $router->add('/users', array(
        'namespace' => 'Me\Security\Controllers',
        'controller' => 'Users',
        'action' => 'index',
    ));

and in the class which Me\Security\Controllers\Users inherits from I have the in the initialise method

<?php
    $this->view->setViewsDir($this->config->security->viewsDir);

which corresponds to app/extensions/security/views/.

I realised that it was partly because one system was case-sensitive and the other was not (that threw me for a while...) but am confused as to why one directory needs a capital letter and the other must be lowercase?

edited Aug '15

try putting the controller name with lower case letters and your directory will be lower case too. How you call the controller and action does matter when you define routes

<?php
    $router->add('/users', array(
        'namespace' => 'Me\Security\Controllers',
        'controller' => 'users',
        'action' => 'index',
    ));