The SQLite3 Class has an option like this.
$db = new SQLite3('mysqlitedb.db', SQLITE3_OPEN_READONLY);
In PDO you would simply open with:
$db = new PDO('sqlite:mysqlitedb.db');
My question is however, is there a way to open a database with PDO, in READONLY mode?
This will become possible with the release of PHP 7.3 (estimated for release in late 2018).
The syntax is as follows:
$db = new PDO('sqlite:mysqlitedb.db', null, null, [PDO::SQLITE_ATTR_OPEN_FLAGS => PDO::SQLITE_OPEN_READONLY]);
Upstream commit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With