Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP CodeIgniter 404 on deploy

Oooops I did it again.

My site worked perfectly locally

My development machine is a windows WAMP2 setup My server is a CentOS 5.5 APACHE 2.2 PHP5 seup

I'm getting a 404 on the codeigniter site that I've deployed, and I really can't make out what's wrong, so please help me find the error.

It's the root url. I haven't set up dns so it's just the ip address of the server. It was showing the standard apache page before I uploaded codeigniter. I've looked over the config file, and it looks ok. Could it be a file permissions error? i have set chmod o+rw in the whole /var/www/html dir. the error_log in the httpd shows nothing

I've tried testing if it was the mod_rewrite module, but I created a test directory with a .htaccess file with RewriteEngine ON that didn't give me an error, so that can't be it.

In codeigniter I've set the log_threshold to 4 in the config, but I don't get any log messages, so I can't really make out if it's a pre-> codeigniter error, but I really don't think it is, as it's loading my Error view, still Why isn't there any log being written, what's it about?

Any help would be extremely appreciated as I'm running on fumes to get this working...

Update Thanks to @jondavidjohn I have discovered that hitting the controller directly IE:

http://addr/index.php/GeoController/markers/

Will provide me with a controller specific error saying:

unable to locate your model "modelname"

SOLVED Thanks to @jondavidjohn, and @timdream for giving me the clues to solve this one. It was a naming problem, I had filenames that were camelcased, and they can only be small from what I understand now, so the ROUTE was innefective in that it lead to Site, but should've lead to site although I had a Site.php I had to change it and the route to site.php

like image 988
Jakob Avatar asked Jan 26 '11 16:01

Jakob


3 Answers

make sure you have the correct settings in system/application/config/config.php.. pay special attention to

$config['base_url'] = "http://www.example.com";

Make sure you are putting in the root domain of your site, also check your routing config and make sure you have the correct default controller set in system/application/config/routes.php

like image 106
jondavidjohn Avatar answered Sep 27 '22 22:09

jondavidjohn


I recently started using a fresh install of codeignitor 3.0 and had no problems on my dev server (Windows) then when I moved to my live server (Linux) I started getting a 404 error.

The reason for this is that in 3.0 you are meant to capitalise the first letter of your controllers/models and also the file name.

e.g.

class Test_model extends CI_Model {

Test_model.php

Hope this helps some people who end up here!

For reference:

http://www.codeigniter.com/userguide3/installation/upgrade_300.html

like image 30
Alex Rapso Avatar answered Sep 27 '22 22:09

Alex Rapso


$config['uri_protocol'] could also play a part. It's default to AUTO, which looks for environment variable that contains the actual URL automatically.

I had a web app that fails when I switch to php-cgi from mod_php for my server. Changing the config to REQUEST_URI solves the issue. I found the valve by digging phpinfo() outputs, you could try to do that.

like image 32
timdream Avatar answered Sep 27 '22 22:09

timdream