0

The following URL part works as expected on my Windows WAMP machine (running using AMPPS), but fails on the Linux production host:

index.php?r=customchocolates/index

I get the following error: Unable to resolve the request "customchocolates/index"

On Windows, I followed the naming convention of CustomChocolates in all the relevant files. However, after searching on-line, I changed the following files to: controller: customChocolatesController.php model: customChocolates.php views dir: customChocolates

I've also updated all the class names to the new name, but I'm still getting the error.

tereško
  • 58,060
  • 25
  • 98
  • 150
Mina
  • 610
  • 7
  • 21

3 Answers3

1

Windows = file name case insensitive

Linux = file name case sensitive

Change your route to customChocolates/index

nkamm
  • 627
  • 5
  • 14
  • Thanks, @nkamm for a reply. Does that mean I have to also change all the other files, too? Cuz I tried your suggestion and it still gave me the same error... – Mina Nov 10 '13 at 19:41
  • Can you share the route in configuration? – nkamm Nov 10 '13 at 19:44
  • im new to yii. can you explain what you mean by route in configuration? do routes need to be defined explicityly? – Mina Nov 10 '13 at 19:47
  • Routes are rules for CUrlManager. I prefer to define rules explicitly, but there is default pattern "Controller/Method". You changed your URL (not a route as I believe, i.e. you use this generic route). So try rename your file (as Mikhail said). – nkamm Nov 10 '13 at 19:50
  • http://www.yiiframework.com/doc/guide/1.1/en/topics.url#user-friendly-urls Try rename your file and classname first. The problem of not rendered view is not in view, but in fact that Yii can't find your controller – nkamm Nov 10 '13 at 20:00
1

Try to rename customChocolatesController.php to CustomChocolatesController.php, and be sure, that controller class name also CustomChocolatesController. And rename you route as nkamm says.

Mihail
  • 1,543
  • 1
  • 10
  • 6
  • tried that when I first uploaded the site because that's how I had it on my Windows machine.. and it didnt work. Tried it again now.. again, didnt work... – Mina Nov 10 '13 at 19:46
  • Try to re-create file with controller on Windows machine with right file name, it may help. – Mihail Nov 10 '13 at 19:50
  • I can't recreate the problem on my Windows machine.. whatever permutation of customchocolates I give it.. it renders the index view. =/ – Mina Nov 10 '13 at 19:56
  • Have you upload newly created file from Windows to Linux machine? Be sure, that file with new file name appears in Linux machine – Mihail Nov 10 '13 at 20:02
  • i got the site working on my Linux laptop. I can reproduce the error now. But I can't solve it. :( – Mina Nov 11 '13 at 07:59
0

Moved my site to my Linux laptop to reproduce the problem. Got the same problem as on production.

I solved it (I don't know why - perhaps someone more knowledgeable and experienced can explain) by doing the following:

  1. renamed controller file and class names to CustomchocolatesController
  2. Removed caseSensitive from URLManager block in config
  3. Renamed views folder to customchocolates

Thanks to @nkamm and @Mihail for their time last night.

Mina
  • 610
  • 7
  • 21