Reputation: 360
I've been searching a lot and tested several different ways to tackle this... but nothing worked so far. I've just uploaded a website to my server and after all the necessary changes it returned the following error - that I've never seen before.
This is the screen shot when I first uploaded the files online...
Well, after some testing and researching, I've changed the name of my controllers do capitalized - and models - and the "php" part of the page stop showing up.
Here is my set up:
FOLDER: website is inside a folder /site/
application/
favicon/
system/
index.php
.htaccess
robots.txt
CONTROLLER: I've tested changing to CI_Controller - even though I'm working on CI 1.7.2 - and __construct()... didn't work
class Home extends Controller
{
// SET LAYOUT DEFAULT
public $layout = 'default';
// SET TITLE DEFAULT
public $title = '';
// SET CSS DEFAULT
public $css = array('scripts/fancybox/jquery.fancybox');
// SET JAVASCRIPT DEFAULT
public $js = array('scripts/fancybox/jquery.fancybox.pack');
function Home () {
parent :: Controller();
// LOAD Libraries
$this->load->library(array('createdate','minitextile','showimages'));
// LOAD Models
$this->load->model('site_model');
}
function index () {
$data['website_info'] = $this->config->item('w_infos');
// LOAD VIEWS
$this->load->view ('include/home_view', $data);
}
}
CONFIG - I've put only the essencial here...
$config['base_url'] = "http://domain.com/site/";
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI"; // Tested with AUTO, didn't work
$config['enable_hooks'] = TRUE;
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
HTACCESS - the files are based inside the folder /site/
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /site/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
</IfModule>
ROUTES:
$route['default_controller'] = "home";
My Log: This is after the controllers name change
DEBUG - 2016-11-21 15:54:22 --> Config Class Initialized
DEBUG - 2016-11-21 15:54:22 --> Hooks Class Initialized
DEBUG - 2016-11-21 15:54:22 --> URI Class Initialized
ERROR - 2016-11-21 15:54:22 --> 404 Page Not Found --> home
Before the name change (to caps) it was like this:
DEBUG - 2016-11-21 14:08:28 --> Config Class Initialized
DEBUG - 2016-11-21 14:08:28 --> Hooks Class Initialized
DEBUG - 2016-11-21 14:08:28 --> URI Class Initialized
DEBUG - 2016-11-21 14:08:28 --> No URI present. Default controller set.
DEBUG - 2016-11-21 14:08:28 --> Router Class Initialized
DEBUG - 2016-11-21 14:08:28 --> Output Class Initialized
DEBUG - 2016-11-21 14:08:28 --> Input Class Initialized
DEBUG - 2016-11-21 14:08:28 --> Global POST and COOKIE data sanitized
DEBUG - 2016-11-21 14:08:28 --> Language Class Initialized
ERROR - 2016-11-21 14:08:28 --> 404 Page Not Found --> home/index
I know that I'm new, and there are a lot of post on this issue out there... I only ask after making some (a lot) of testing my self - at least as far as my knowledge goes :D I've been using this CI version and set up for a while - and been meaning to upgrade to CI 3 - and I've tested/changed everything I could imagine and faced over many different hosts/servers and still I could not find a way around this.
Upvotes: 0
Views: 349
Reputation: 360
Figured it out! Thanks for the help... but it was a problem on the PHP configuration... the short_open_tag
wasn't activated on the served... and it took me a while to see it! :p So tip: Check some php config too.
Upvotes: 0
Reputation:
It could be because
function Home () {
parent :: Controller();
// LOAD Libraries
$this->load->library(array('createdate','minitextile','showimages'));
// LOAD Models
$this->load->model('site_model');
}
Should be http://www.codeigniter.com/user_guide/general/controllers.html#class-constructors
function __construct() {
parent::__construct();
// LOAD Libraries
$this->load->library(array('createdate','minitextile','showimages'));
// LOAD Models
$this->load->model('site_model');
}
Make sure your file names correct also when upgrading Home.php only the first letter upper case. as explained here http://www.codeigniter.com/user_guide/general/styleguide.html#file-naming
Upvotes: 1