Welcome Guest, Not a member yet? Register   Sign In
Another My_Controller not found problem ... but this one is a bit different !
#1

[eluser]Monarobase[/eluser]
Hello,

I've been pulling my hair out trying to find a solution for this one so I thought I would ask you for some advice !

I've extended the controller class with MY_Controller and it works fine on MAMP but when I run it on my production server MY_Controller doesn't seem to get loaded !

Codeigniter version : 1.7.2

Error :
Code:
Fatal error: Class 'My_Controller' not found in ... line 3

File : application/libraries/MY_Controller.php

File Contents :
Code:
<?php
class MY_Controller extends Controller {

   function MY_Controller()
    {
        parent::Controller();
    }

    function login() {
                //LOAD VIEW AND LOGIN
        }
}

Controller contents :

Code:
<?php
class View extends MY_Controller {
    
    function View() {
        parent::MY_Controller();
        $this->db->query("SET NAMES 'utf8'");
        $this->session->expire_cookie(false);
    }
    
    function index() {

    }
}

MAMP PHP version : 5.2.11

PRODUCTION SERVER PHP version : 5.2.11

The files are identical, I uploaded a zip file containing all the files and unzipped it to make sure none were lost during FTP upload...

Any advice would be most appreciated !
#2

[eluser]jedd[/eluser]
Hi Monarobase - this is described in lurid detail in [url="/wiki/MY_Controller"]the wiki[/url], as well as the [url="/wiki/FAQ"]FAQ section[/url] of same.

Typically the biggest problem people have when moving between platforms is case-sensitivity.

This line from your message is a giveaway:

[quote author="Monarobase" date="1272921923"]
Error :
Code:
Fatal error: Class 'My_Controller' not found in ... line 3
[/quote]

The fact that it's looking for 'My' rather than 'MY' means that you've got a typo somewhere, or you've misnamed your file. It looks like your file is named properly .. so ...
#3

[eluser]Monarobase[/eluser]
Wow I do feel stupid about that one ! Thanks for saving me alot of time ! There I was thinking I had something complex to deal with !

I took it for granted that because Mac OS is Unix based MAMP's PHP would be case sensitive just like on my server ! Had I been working on a Windows machine it would have been one of the first things I would have checked as my very first headache in HTML (about 11 years ago) was caused by case sensitivity !
#4

[eluser]jedd[/eluser]
[quote author="Monarobase" date="1272928277"]
Thanks for saving me alot of time !
[/quote]

The wiki is your friend. Smile

Quote:I took it for granted that because Mac OS is Unix based MAMP's PHP would be case sensitive just like on my server ! Had I been working on a Windows machine it would have been one of the first things I would have checked as my very first headache in HTML (about 11 years ago) was caused by case sensitivity !

It's a file system thing, rather than an OS thing. I think with modern OSX versions you get the choice of four file systems - two of which are case sensitive, two aren't. The two that aren't still respect (retain) case - much like NTFS and VFAT do - they just ignore it.
#5

[eluser]Steve Wanless[/eluser]
I just joined the stupid club also. Testing on my production server I ran into the same problem and spent far too long trying to figure out what was wrong.
In a last ditch effort (before I planned on posting to the forum) I decided to google the exact problem I was having;
"codeigniter my_controller works on XAMPP but not my production server"

And what do ya know, I found this post.




Theme © iAndrew 2016 - Forum software by © MyBB