doucongmishang2385 2016-06-13 10:54
浏览 112

使用PHP连接到SQLite数据库

With the reference of the bellow link,I was tried to connect with an sqlite database using PHP.

How do I connect to an SQLite database with PHP?

<?php
$dir = 'sqlite:/var/www/html/shijin/brandz_db';
$dbh  = new PDO($dir) or die("cannot open the database");

But i am getting the following error,

Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /var/www/html/shijin/sqlite.php:3 Stack trace: #0 /var/www/html/shijin/sqlite.php(3): PDO->__construct('sqlite:/var/www...') #1 {main} thrown in /var/www/html/shijin/sqlite.php on line 3

  • 写回答

1条回答 默认 最新

  • douwu3763 2016-06-13 11:06
    关注

    You need to install the PDO sqlite driver. Try

    sudo pecl install pdo
    sudo pecl install pdo_sqlite
    
    评论

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题