Search code examples
cakephpuploadcamelcasing

CakePHP CamelCase names after upload on server


My problem is quite strange. I'm developing CakePHP application. At the beginning I was doing all stuff on my local server with Windows... and works pretty good. But now I had to do upload to company's server. Now the app doesn't work due to CamelCase convention. My filenames looks like this: PostCategoriesController. On local Windows server there's no problem. But after upload when I type web address in my browser I see PostcategoriesController could not be found. I know Windows and Linux are case-sensitive in different ways. However in Cookbook we can read that developers should use CamelCase convention, so what I'm doing wrong?


Solution

  • As figured in the comments, you were using postcategories instead of something like post_categories in the URL, and so CakePHP cannot properly inflect this to PostCategories as there is no separator for the the words, and so you'll end up with Postcategories, which only works only Windows systems as its filesystems are case-insensitive (except for NFS on some server version if I remember correctly).

    See also Cookbook > CakePHP conventions > URL Considerations for Controller Names

    As can be seen in the docs it's also possible to use uppercase chars to indicate multiple words, ie postCastegories or PostCategories would work in a URL too.