Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter without a Database?

Sorry if this is a simple question, is it possible to load codeigniter without a db setup?

I have sess_use_db set to false in the config, I tried renaming database.php to something else but it still wants to load it, I turned active records off also.

I tried commenting everything out in the database.php and it said no database settings found, autoload doesn't load the db.

Is this even possible?

like image 355
Doug Molineux Avatar asked Aug 04 '10 18:08

Doug Molineux


4 Answers

Theoretically, there should be no reason that CI needs a database. sess_use_db=false just stops CI from storing it's session information in a database. Check that you are not autoloading the database files in config/autoload.php

You could set the database type to 'sqlite' in config/database.php if you simply want to avoid setting up mysql, but you will need to have sqlite installed.

HTH

like image 197
jalal Avatar answered Oct 12 '22 02:10

jalal


I know its an old thread but answers for a clearer answer.

You need to check in two places config.php and autoload.php as the website depends on two things which depend on database, which are autoload 'database' & 'sessions' which we need to remove.

But for sessions, rather than eliminating it from autoload, we can keep it by just changing its configuration setting.

In Config.php : you need to modify 'session' settings by changing its driver to:

$config['sess_driver'] = 'files'; .

In autoload.php : you need to modify the 'library' by removing "database" :

$autoload['libraries'] = array('session', 'form_validation');

Also, do make sure that your site doesn't have any funtions calling for database.

That should fix your issues.

like image 27
Abdulaziz Hamdan Avatar answered Oct 08 '22 19:10

Abdulaziz Hamdan


You just need to remove or comment the following line from autoload.php file in config folder:

$autoload['libraries'] = array('database','session');
like image 13
Wasim Ahmed Avatar answered Oct 12 '22 04:10

Wasim Ahmed


I think you should check your $autoload['libraries'] and remove database.

like image 7
milo Avatar answered Oct 12 '22 03:10

milo