• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with case sensitive in loading controllers

#1
I am using Codeigniter 3.0

I am experiencing some strange behaviour in codeignitor.

i have two methods in my Profile controller, an index() and a user().

When i visit localhost/profile/ I get the index as expected.

When i visit localhost/profile/user/… i get a 404. However if i capitilize the controller name to localhost/Profile/user/… then i see my user method.

If i change the class name to lowercase in the controller then my index method will not load up either.

Anybody have any ideas?

Thanks in advance
Reply

#2
Is your controller file name profile.php. It should be Profile.php.
Reply

#3
i am using codeigniter 3.0

i am used to access method like localhost/Profile/user/ its working perfectly, but i need to use url like localhost/profile/user/

my controller name is Profile.php and class name Profile.

how can i use url like localhost/profile/user/
Mansoor H Wink
Reply

#4
This is going to be a problem, CI should not care about the file name case but the class name case, almost all web hosting providers that run Linux servers require lower case file names.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#5
(06-09-2015, 10:59 PM)InsiteFX Wrote: This is going to be a problem, CI should not care about the file name case but the class name case, almost all web hosting providers that run Linux servers require lower case file names.

Actually, CI cares about filename casing ... class names in PHP are not case-sensitive, no matter what OS it runs on.

Also, this is the first time I hear about a hosting provider requiring all-lower-case filenames, that's just batshit insane. I suspect some custom routes are the problem here.
Reply

#6
(06-10-2015, 01:34 AM)Narf Wrote:
(06-09-2015, 10:59 PM)InsiteFX Wrote: This is going to be a problem, CI should not care about the file name case but the class name case, almost all web hosting providers that run Linux servers require lower case file names.

Actually, CI cares about filename casing ... class names in PHP are not case-sensitive, no matter what OS it runs on.

Also, this is the first time I hear about a hosting provider requiring all-lower-case filenames, that's just batshit insane. I suspect some custom routes are the problem here.


@Narf

I have had to work on some client sites where the file names had to be all lower case or the site would not see the file name.

My web site does not care the case even on directories.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#7
(06-10-2015, 03:45 AM)InsiteFX Wrote:
(06-10-2015, 01:34 AM)Narf Wrote:
(06-09-2015, 10:59 PM)InsiteFX Wrote: This is going to be a problem, CI should not care about the file name case but the class name case, almost all web hosting providers that run Linux servers require lower case file names.

Actually, CI cares about filename casing ... class names in PHP are not case-sensitive, no matter what OS it runs on.

Also, this is the first time I hear about a hosting provider requiring all-lower-case filenames, that's just batshit insane. I suspect some custom routes are the problem here.


@Narf

I have had to work on some client sites where the file names had to be all lower case or the site would not see the file name.

My web site does not care the case even on directories.

CI2 may want you to have some files in lower-case in some cases; CI3 requires class file names to be in Ucfirst. The hosting provider doesn't have control over this and even if it did - it would make no sense.

If it doesn't make a difference, then you're just running on a case-insensitive file system. That's the case on Windows, case-insensitive OSX (configurable during OS setup IIRC) or some weird Linux box that actually uses NTFS or something.
Reply

#8
OS X and Linux case sensitivity are based on the file system, and configurable when defining/formatting the partition on the drive (if the file system itself supports case-insensitivity, since most do not).

Some FTP clients include an option to convert the filenames to lowercase. It may be the case that some hosting providers have a web-based file uploader which automatically converts filenames to lowercase as well.

As Narf already said, converting the filenames to lowercase is crazy, and I would put it at a level only slightly crazier than case-insensitive filesystems.
Reply

#9
I have about 100+ controllers, 80+ models and 50+ libraries and probably well over 150+ views. A crazy crazy enterprise platform. I upgraded from CI 2 to CI 3.

There was no way lol, that I was going to change all the filenames from lowercase to uppercase. Nope, don't have the time for that silly stuff.

You can change codeigniter 3 to revert back to lowercase. Of course and before anyone jumps down my throat, 1) you have to know what you are doing and 2) you better know how to maintain your installation should any problems occur and 3) don't forget to change for future versions.

The changes I made work well, haven't had a single issue and the application runs like CI 2.0.

So yeah, you can side-step any issue here. You just gotta know the framework code.
Reply

#10
I modified my (already extended) loader to load files using either lowercase or ucfirst, but I still took the time to change my filenames (because, at some point, I'm going to remove the code which checks for the lowercase filename). I ended up changing the names of a little over 400 files, but they never would have had the previous filenames if it hadn't been for CI2's filename requirements. I may still have some issues with the way CI handles class/file names, but getting rid of the all-lowercase file names is not one of them.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.