In my controller (controllers/user.php), I have:
class User extends CI_Controller
{
public function index()
{
$this->load->model('user_model')or die("error");
}
}
In my model (models/user_model.php), I have
class User_model extends CI_Model
{
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->helper('common');
}
}
If I remove the
or die("error");
from the load statement, I get a 500 internal server error.
I checked config.php and here's some info
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
I have also edited the .htaccess file to remove the "index.php" from the URL to make it cleaner.
RewriteEngine On
RewriteCond $1 !^(index.php|images|captcha|css|js|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
$this->load->model('user_model')or die("error");and put echo 'a'; exit; If it gives you 'a' then your problem is related to the model. The next thing you should do if check your application/config/database.php for configuration. You can exit after $this->load->database(); (before loading the helper) to see if it is the database connection