CodeIgniter Forums
Controller not working after uploading to remote server!!! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Controller not working after uploading to remote server!!! (/showthread.php?tid=3998)

Pages: 1 2


Controller not working after uploading to remote server!!! - El Forum - 11-01-2007

[eluser]wavefade[/eluser]
I have been working on a simple application on my local machine. I uploaded to the remote server and now I get a 404 error when trying to run a certain controller. Everything is exactly the same as far as I can tell. I fixed my base_url and everything to be set correctly.

The site is: http://www.cityofhazard.com/new

On my machine I have a pages controller and a function named view that when passed a parameter (parent page) it will display a section of pages for that parent page. Everything worked fine until I uploaded.

I am running php5 appache 1.3 on mac os x...im hosted with site5...

any clue what is causing this???

I'll attach a screenshot of what I get on my local machine...


Controller not working after uploading to remote server!!! - El Forum - 11-01-2007

[eluser]gtech[/eluser]
unless I am missing something (which is quite possible) there isn't much to go on here?

I tried loading you home page, which was fine and then tried clicking on the community and departments link which resulted in the 404 page.

note when I tried the following link:

http://cityofhazard.com/new/index.php/pages

it redirected me to your home page.. which shows to me that the pages controller is there and is redirecting me if I don't pass any parameters. maybe we need to see your pages controller and the view function.

http://cityofhazard.com/new/index.php/pages/view will result in a 404 error which kind of suggests the view function doesn't exist in the controller?


Controller not working after uploading to remote server!!! - El Forum - 11-01-2007

[eluser]wavefade[/eluser]
Hold on I will copy my code. I'm a newbie, and what I am trying to accomplish may be done much more efficiently...but it is still working on my local machine and I've tried re-uploading all the files twice. I am using cyberduck for FTP....maybe a different application would work better.
Code:
<?php

class Pages extends Controller {

    function Pages()
    {
        parent::Controller();
        $this->load->scaffolding("contents");    
    }
    
    function index()
    {
        redirect("welcome");
    }
    
    function view()
    {

        $data['query'] = $this->db->getwhere("contents", array('parent' => $this->uri->segment('3')));
        $data['section'] = $this->uri->segment('3');
        
        $this->load->view("pages_view", $data);
    }
    
}
?>



Controller not working after uploading to remote server!!! - El Forum - 11-01-2007

[eluser]wiredesignz[/eluser]
$this->uri->segment(3), might work better.

On another note, Querying the database directly from a Controller is not a good idea.

If you add a Model to do database queries then if you decide to change the data source (to an array maybe) you don't have to modify your Controller code.


Controller not working after uploading to remote server!!! - El Forum - 11-01-2007

[eluser]gtech[/eluser]
your code looks fine, and if it works locally it obviously is! If there was a problem in the view function you would not get a 404 error, its because somehow the view function does not exist.

To me it looks like you have the wrong pages.php uploaded on your remote server. could you view the file on the remote machine and check it?

or can your download it from your remote server to your local machine and do a diff on your local copy? You might even have some odd characters on the uploaded file

the behaviour I am getting suggests the pages.php on the remote server is somthing like

Code:
<?php

class Pages extends Controller {

    function Pages()
    {
        parent::Controller();
        $this->load->scaffolding("contents");    
    }
    
    function index()
    {
        redirect("welcome");
    }
}
?>

Without being able to see the remote server files I can only guess... sorry


Controller not working after uploading to remote server!!! - El Forum - 11-01-2007

[eluser]wavefade[/eluser]
That is what it looks like it is doing to me too...but I am actually logging in and copying the code right off my server. I just used a different FTP program to upload it and it still isn't working right. I am going to try and rebuild it on the server and see if that works.


Controller not working after uploading to remote server!!! - El Forum - 11-01-2007

[eluser]gtech[/eluser]
hey an idea... I suppose you could change the redirect on the index function then upload the file.. at least then you know you are copying your files to the correct place and the server is picking them up!


Controller not working after uploading to remote server!!! - El Forum - 11-01-2007

[eluser]wavefade[/eluser]
yea it's definitely not working.

i just started with a fresh installation of CI...copied only the files needed for this application...manually edited the config files and nothing....it has to be something on my server...im going to check the site5 forums....maybe someone else has this problem.


Controller not working after uploading to remote server!!! - El Forum - 11-01-2007

[eluser]gtech[/eluser]
sorry I couldn't help any more.. good luck!


Controller not working after uploading to remote server!!! - El Forum - 11-01-2007

[eluser]wavefade[/eluser]
unfortunately noone on site5's forums know anything about codeigniter....this sucks...