如何在php中启用sqlite3的PDO驱动程序?

时间:2022-05-14 05:35:48

My SQLite is version 3.4.0: image

我的SQLite是版本3.4.0:图像。

However my phpinfo's PDO support for SQLitev3 is not enabled/listed: image

但是我的phpinfo对SQLitev3的PDO支持没有启用/列出:image

How can I enable it? I installed my web server via XAMPP.

如何启用它?我通过XAMPP安装了我的web服务器。

4 个解决方案

#1


5  

I think that the PDO driver for sqlite3 is called 'sqlite', so you already have it installed. The sqlite2 driver is older.

我认为sqlite3的PDO驱动程序被称为sqlite,所以你已经安装了它。sqlite2驱动程序比较老。

PDO_SQLITE is a driver that implements the PHP Data Objects (PDO) interface to enable access to SQLite 3 databases.

PDO_SQLITE是一个驱动程序,它实现PHP数据对象(PDO)接口,以支持对SQLite 3数据库的访问。

In PHP 5.1, the SQLite extension also provides a driver for SQLite 2 databases; while it is not technically a part of the PDO_SQLITE driver, it behaves similarly, so it is documented alongside it. The SQLite 2 driver for PDO is provided primarily to make it easier to import legacy SQLite 2 database files into an application that uses the faster, more efficient SQLite 3 driver. As a result, the SQLite 2 driver is not as feature-rich as the SQLite 3 driver.

在PHP 5.1中,SQLite扩展还提供了SQLite 2数据库的驱动程序;虽然从技术上讲,它不是PDO_SQLITE驱动程序的一部分,但它的行为是类似的,因此它与它一起被文档化。PDO的SQLite 2驱动程序主要是为了更容易地将遗留的SQLite 2数据库文件导入到使用更快、更高效的SQLite 3驱动程序的应用程序中。因此,SQLite 2驱动程序不如SQLite 3驱动程序功能丰富。

From http://php.net/manual/en/ref.pdo-sqlite.php

从http://php.net/manual/en/ref.pdo-sqlite.php

#2


8  

Go to your php.ini file and search for "sqlite". These are probably commented:

去你的php。ini文件和搜索“sqlite”。这些可能是评论道:

extension=php_pdo_sqlite.dll

extension=php_sqlite.dll

Uncomment them, and restart Apache.

取消注释,重新启动Apache。

#3


0  

"pdo_sqlite" and "sqlite3" are different extensions and are loaded in php.ini in different lines:

“pdo_sqlite”和“sqlite3”是不同的扩展,在php中加载。ini在不同的行:

extension=php_pdo_sqlite.dll

extension=php_sqlite3.dll

#4


-1  

edit: there is a discussion on the topic here:

编辑:这里有一个关于这个话题的讨论:

http://www.apachefriends.org/f/viewtopic.php?f=16&t=34389&sid=c99e3edebef9f297aff3f2f179c50ccc&p=141255

http://www.apachefriends.org/f/viewtopic.php?f=16&t=34389&sid=c99e3edebef9f297aff3f2f179c50ccc&p=141255

#1


5  

I think that the PDO driver for sqlite3 is called 'sqlite', so you already have it installed. The sqlite2 driver is older.

我认为sqlite3的PDO驱动程序被称为sqlite,所以你已经安装了它。sqlite2驱动程序比较老。

PDO_SQLITE is a driver that implements the PHP Data Objects (PDO) interface to enable access to SQLite 3 databases.

PDO_SQLITE是一个驱动程序,它实现PHP数据对象(PDO)接口,以支持对SQLite 3数据库的访问。

In PHP 5.1, the SQLite extension also provides a driver for SQLite 2 databases; while it is not technically a part of the PDO_SQLITE driver, it behaves similarly, so it is documented alongside it. The SQLite 2 driver for PDO is provided primarily to make it easier to import legacy SQLite 2 database files into an application that uses the faster, more efficient SQLite 3 driver. As a result, the SQLite 2 driver is not as feature-rich as the SQLite 3 driver.

在PHP 5.1中,SQLite扩展还提供了SQLite 2数据库的驱动程序;虽然从技术上讲,它不是PDO_SQLITE驱动程序的一部分,但它的行为是类似的,因此它与它一起被文档化。PDO的SQLite 2驱动程序主要是为了更容易地将遗留的SQLite 2数据库文件导入到使用更快、更高效的SQLite 3驱动程序的应用程序中。因此,SQLite 2驱动程序不如SQLite 3驱动程序功能丰富。

From http://php.net/manual/en/ref.pdo-sqlite.php

从http://php.net/manual/en/ref.pdo-sqlite.php

#2


8  

Go to your php.ini file and search for "sqlite". These are probably commented:

去你的php。ini文件和搜索“sqlite”。这些可能是评论道:

extension=php_pdo_sqlite.dll

extension=php_sqlite.dll

Uncomment them, and restart Apache.

取消注释,重新启动Apache。

#3


0  

"pdo_sqlite" and "sqlite3" are different extensions and are loaded in php.ini in different lines:

“pdo_sqlite”和“sqlite3”是不同的扩展,在php中加载。ini在不同的行:

extension=php_pdo_sqlite.dll

extension=php_sqlite3.dll

#4


-1  

edit: there is a discussion on the topic here:

编辑:这里有一个关于这个话题的讨论:

http://www.apachefriends.org/f/viewtopic.php?f=16&t=34389&sid=c99e3edebef9f297aff3f2f179c50ccc&p=141255

http://www.apachefriends.org/f/viewtopic.php?f=16&t=34389&sid=c99e3edebef9f297aff3f2f179c50ccc&p=141255