--TEST-- PDO_sqlite: Testing open flags --EXTENSIONS-- pdo_sqlite --FILE-- PDO::ERRMODE_EXCEPTION]); var_dump($db->exec('CREATE TABLE test1 (id INT);')); $db = new PDO('sqlite:' . $filename, null, null, [PDO::SQLITE_ATTR_OPEN_FLAGS => PDO::SQLITE_OPEN_READONLY, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); var_dump($db->exec('CREATE TABLE test2 (id INT);')); ?> --CLEAN-- --EXPECTF-- int(0) Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in %s Stack trace: %s #1 {main} thrown in %s