0
我在debian7。爲什麼不能用PDO創建sqlite數據庫?
<?php
echo "creating a databse \n";
try {
$dbh=new PDO('sqlite:voting.db');
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->exec('
CREATE TABLE tally(
QID varchar(32) NOT NULL,
AID integer NOT NULL,
votes integer NOT NULL,
PRIMARY KEY(QID,AID)
)');
} catch (Exception $e) {
echo "error!!:$e";
exit;
}
echo "db created successfully!";
?>
我要創造我的SQLite數據庫voting.db
的代碼,它跑翻過錯誤信息:
creating a databse error!!:exception 'PDOException' with message 'could not find driver' in /var/www/sqlite1.php:4
Stack trace: #0 /var/www/sqlite1.php(4):
PDO->__construct('sqlite:voting.d...') #1 {main}
如何解決呢?