July 14, 2010

PHP pdo apache sqlite3

I got my php+pdo+sqlite3 to work under apache now. Some tips to remember:

1. The folder that houses the database file must be writeable by the user "apache"
2. Database files has to be writable by the user "apache"
3. after installing php-pdo package, remember to restart apache/httpd service, because mod_php is in memory.
4. remeber to put the following code at the beginning of the php code to enable debugging:

ini_set('display_errors', 'On');
error_reporting(E_ALL);

5. remember to enable PDO debugging

try {$handle = new PDO("sqlite:".$db); }
catch(PDOException $e) { echo $e->getMessage(); return;}
$handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);

No comments:

Post a Comment