assaf
(Assafwint)
April 3, 2014, 6:04pm
1
Hi,
Probably this is an easy one but I am just not able to figure this out for a few days now.
Yii autoload model is not working for me on linux,
Explenation:
in config/main.php
I have:
‘import’=>array(
'application.models.*',
'application.components.*',
...
...
...
),
Now on windows everything is working fine,
but on linux I get for example a php warning: "include(UserIdentity.php) Failed to open stream: No such file or directory".
This happens when I try to login.
This error occurs for any model / component / extension which Yii tries to load.
The only solution that worked for me was to modify the import array to specify every single file to include:
‘import’=>array(
...
'application.components.[b]UserIdentity[/b]',
...
...
...
),
But this does not make any sense because in older Yii distros I had no issues like this one and it makes me include a million files manually.
non the less, UserIdentity.php is generated automatically by Yii so the naming should be fine.
I also verified that the class names and file names match (case sensitive).
I am using Yii 1.1.14 on centos 5.9 with apache.
Can it be related to server configuration?
Any ideas would be very much appreciated!
Thank you so much!
If somthing works on windows but not on *nix, it’s always the case-sensitiveness.
The question is, where did you miss it.
What’s the full path to UserIdentity.php?
assaf
(Assafwint)
April 4, 2014, 6:22am
3
If somthing works on windows but not on *nix, it’s always the case-sensitiveness.
The question is, where did you miss it.
What’s the full path to UserIdentity.php?
Hi, Thank you for your reply,
The full path is:
/var/www/html.web03\:443/protected/components/UserIdentity.php
and the class name is: "class UserIdentity"
Any ideas?
Thanks
Quentinb
(Quentin)
April 4, 2014, 6:45am
4
I am sitting with the same problem. Seems like my only solution will be to change all my URL’s to the correct controller name case.
This kind of reminds me why I LOVE doing Java development. CODE ONCE RUN ANYWHERE
assaf
(Assafwint)
April 4, 2014, 7:12am
5
Quentinb:
I am sitting with the same problem. Seems like my only solution will be to change all my URL’s to the correct controller name case.
This kind of reminds me why I LOVE doing Java development. CODE ONCE RUN ANYWHERE
What do you mean by “change all my URL’s to the correct controller name case” ?
How will it affect to auto loading of models / classes?
Quentinb
(Quentin)
April 4, 2014, 7:28am
6
I think my problem is different, but comes down to the same issue.
My controller classes are for example named:
MyLoginController
My URL’s are for example:
mylogincontroller/login
Linux cannot find the url because the cases are not the same. I have to change all my URL’s to match the controller case. Example URL: MyLoginController/login
When I do that, Linux is happy.
assaf
(Assafwint)
April 6, 2014, 6:58am
7
Anyone else has an idea?
I guess I’m going to have to move this post to stack exchange, if a solution comes up I’ll post it here…
boaz
(Boaz Rymland)
April 7, 2014, 4:57am
8
Long shot but make sure that the component class name is the same as the filename it sits in and the only difference is the addition of ".php" suffix to the filename.
Double check character-cases including all your usage of the classes (where you call/instantiate them). They should all ‘sing the same song’… .