Su PHP8, sqlite è regolarmente funzionante.
Ho testato anche con PHP8.4 questo esempio che crea un db, scrive e legge correttamente.
Codice PHP:
<doctype html>
<head>
<title> test PDO sqlite</title>
</head>
<body>
<?php
try {
$db = new PDO('sqlite:test_database.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->exec("CREATE TABLE IF NOT EXISTS test (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT
)");
$db->exec("INSERT INTO test (name) VALUES ('Funziona!')");
$stmt = $db->query("SELECT * FROM test");
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "Letto:";
echo "<p>";
print_r($result);
echo "</p>";
} catch (PDOException $e) {
echo "Errore: " . $e->getMessage();
}
?>
</body>
</html>
Puoi verificare le librerie attive con phpinfo()
Per completezza, il modulo sqlite è stato disattivato su PHP5.6 e 7.3 per ragioni di sicurezza. La soluzione è quindi aggiornare a PHP8 o successivi, dove il modulo rimane supportato.
Ciao!