The following code should display a message but shows me nothing (neither on the screen, nor in the source code). Any idea why this may be?
<?php
try
{
//create or open the database
$database = new SQLiteDatabase('myDatabase.sqlite', 0666, $error);
echo 'that works';
}
catch(Exception $e)
{
die('that doesnt: '.$error);
}
I’m using:
- Ubuntu 11.10
- PHP 5.3.6-13ubuntu3.6 with Suhosin-Patch (cli) (built: Feb 11 2012
02:17:16)
phpinfo() shows me the following:
- …
- Additional .ini files parsed: …
/etc/php5/apache2/conf.d/pdo_sqlite.ini,
/etc/php5/apache2/conf.d/sqlite.ini, … - PDO drivers mysql, sqlite
- SQLite Library 3.7.7
- …
SQLite was installed that way:
sudo apt-get install php5-sqlite
SQLiteDatabaseis not a valid class name, at least not in this extension.You’re looking for
Sqlite3:Since the class is undefined, it’s provoking a fatal error, and you probably don’t see anything because of either your
error_reportinglevel ordisplay_errorssetting.