views:

325

answers:

1

Hello, I'm trying to run Sqlite3 with CakePHP. Yes, i know it's not officially supported, but this post here: http://stackoverflow.com/questions/1021980/cakephp-sqlite says it's possible. I've downloaded the new driver file "dbo_sqlite3.7.php" and put it in "cake/libs/model/datasources/dbo". Now I'm having trouble getting connected to the db.

Things I'm confused on:

  1. Where should my database.sqlite file be kept

  2. What should my config file look like. Should I be referencing the full filename of the driver? Like 'driver' => 'dbo_sqlite3.7.php'? And can I use relative paths to the db file?

  3. Is there a difference in sqlite3 files and sqlite2 files by themselves, or is it just the way that you handle the files that makes the difference?

Thank you for your help. I'm new to cake and I'm excited about learning more.

A: 

The driver file should be named dbo_sqlite3.php. You can download the latest version from GitHub.

Your database config could look like this:

var $default = array(
    'driver' => 'sqlite3',
    'database' => 'database.sqlite'
);

CakePHP will look for the database file in app/webroot. You can use an absolute path or a path relative to the webroot directory. For example, if you'd rather store the database in the app directory (one level up from the webroot), you could write:

'database' => '../database.sqlite'
Mike
Mike, thanks for the reply. I'm still not able to connect to the database. Is there anything else that needs to be configured?
Dan
Ok, so I ended up solving the problem. On my OSX Snow Leopard installation, the htaccess modrewrite wasn't being allowed due to apple adding an unknown .httpd config file buried in the filesystem. Once I fixed the htaccess problem, everything started working great. Whew.
Dan