douli8040 2018-05-29 15:25
浏览 90

PDOException - 连接失败 - 找不到驱动程序 - PHP5 / SQLite / Ubuntu

I am having a baffling issue. I've correctly set up PHP5/SQLite before. However, this time it's not working.

The basic expectation of functionality is that I make a generic DB connection using:

$dblocation = "path/to/database.db";
$dbConn = new PDO("sqlite:" . $dblocation); 

From there I am getting the

Connection Failed: Could not find driver.

I have done the following to resolve this.

  1. Checked documentation with: php -a -c /etc/php5/cli/php.ini and phpinfo()

    sqlite3
    
    SQLite3 support => enabled
    SQLite3 module version => 0.7-dev
    SQLite Library => 3.8.2
    
  2. Checked available drivers:

    php > print_r(PDO::getAvailableDrivers());
    Array
    (
       [0] => mysql
       [1] => sqlite
    )
    php >
    
  3. Using Apache2, enabled the pdo and pdo_sqlite

    With that, I don't need to uncomment the extension line in the PHP.ini file. If I do uncomment it, I get the expected unable to unregister error that comes when you have two attempts to load.

  4. Removed all PHP PDO installs and reinstalled.

  5. Removed PHP itself and reinstalled.

None of these have helped.

Like I have said, I have been able to get this to function correctly before, so I am not sure what is wrong here. Hopefully, somebody has a more solid answer than what I can find. From what I am seeing everything appears to be configured correctly.

Any assistance anybody can provide would be very appreciated.

  • 写回答

1条回答 默认 最新

  • dongwen5019 2018-05-29 15:29
    关注

    Keep in mind that PHP CLI uses a different ini than the one used by apache. Try to run an phpinfo(); via the webserver. This should tell you more info.

    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)