$dbhandle = new SQLite3(":memory:"); $dbhandle->close(); $dbhandle->enableExceptions(TRUE); try { $dbhandle->open("not_exists.sqlite3", SQLITE3_OPEN_READWRITE); } catch (Exception $exception) { echo '<p>There was an error connecting to the database!</p>'; }