Title: WP DB Driver
Author: Marko Heijnen
Published: <strong>2013 年 6 月 28 日</strong>
Last modified: 2015 年 12 月 27 日

---

搜尋外掛

![](https://ps.w.org/wp-db-driver/assets/banner-772x250.png?rev=858861)

這個外掛**並未在最新的 3 個 WordPress 主要版本上進行測試**。開發者可能不再對這個
外掛進行維護或提供技術支援，並可能會與更新版本的 WordPress 產生使用上的相容性問題。

![](https://s.w.org/plugins/geopattern-icon/wp-db-driver_464646.svg)

# WP DB Driver

 由 [Marko Heijnen](https://profiles.wordpress.org/markoheijnen/) 開發

[下載](https://downloads.wordpress.org/plugin/wp-db-driver.2.1.0.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/wp-db-driver/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/wp-db-driver/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/wp-db-driver/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/wp-db-driver/#developers)

 [技術支援](https://wordpress.org/support/plugin/wp-db-driver/)

## 外掛說明

This plugin adds an improved database layer to WordPress. It allows you to do more
then the default one and is always up-to-date with the changes core makes.

**mysql_\* functions**

The mysql_* functions are officially deprecated for PHP 5.5 and are throwing E_DEPRECATED
errors.
 On https://core.trac.wordpress.org/ticket/21663 there is discussion on 
this topic.

This plugin reflects those discussions.

**Why should I use this plugin?**

You should use this plugin if you want to start using PDO / MySQLi for WordPress.

## 螢幕擷圖

 * [[
 * The main settings page reports on what database drivers your PHP installation
   supports and lets you enable or disable the custom db.php drop-in for this plugin.

## 安裝方式

 1. Verify that you have PDO or MySQLi
 2. Go to the settings page to install db.php or copy `wp-content/db.php` to your WordPress
    content directory (`wp-content/` by default.
 3. 完成！

## 常見問題集

  Help, I’ve broken my site!

You can visit [http://yoursite.com/?wp-db-driver-emergency-override=1](http://yoursite.com/?wp-db-driver-emergency-override=1)(
replace yoursite.com with your real WordPress blog address) to temporarily disable
this plugin.
 Then you can login to your admin to deactivate the plugin and restore
your site’s functionality.

If you need to uninstall manually, you should remove the plugin folder as well as`
wp-content/db.php`.

  In what order are the drivers picked?

PDO > MySQLi > MySQL

  How do I specify a driver?

In your wp-config.php, add a new constant:

    ```
    define( 'WPDB_DRIVER', 'wpdb_driver_pdo_mysql' );
    ```

You can specify `wpdb_driver_pdo_mysql`, `wpdb_driver_mysqli`, or `wpdb_driver_mysql`.
Any other driver will cause an error.

  Which driver is best for my site?

They should all function equally well for WordPress. The MySQL extension is being
retired. In PHP 5.5, using this extension issues E_DEPRECATED errors.
 In PHP 5.6,
it will no longer be available. The two alternative drivers are PDO and MySQLi. 
If WordPress switches to MySQLi or PDO, some cool new features become available 
to developers.

[http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/](http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/)

  How to configure SSL?

You can set defined in your wp-config.php to make it work. This only works for MySQLi
and PDO.
 These defines are: DB_SSL_KEY, DB_SSL_CERT, DB_SSL_CA, DB_SSL_CA_PATH 
and DB_SSL_CIPHER.

In case of a different port number then you can pass this to your database host 
like: 127.0.0.1:

For more information see:
 – http://dev.mysql.com/doc/refman/5.5/en/ssl-connections.
html

## 使用者評論

這個外掛目前沒有任何使用者評論。

## 參與者及開發者

以下人員參與了開源軟體〈WP DB Driver〉的開發相關工作。

參與者

 *   [ Marko Heijnen ](https://profiles.wordpress.org/markoheijnen/)
 *   [ Kurt Payne ](https://profiles.wordpress.org/kurtpayne/)

[將〈WP DB Driver〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/wp-db-driver)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/wp-db-driver/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/wp-db-driver/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/wp-db-driver/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/wp-db-driver/)。

## 變更記錄

#### 2.1.0

 * Sync with 4.4 ( Changeset 35787)
 * Changed is_mysql logic.

#### 2.0.1

 * Reupload code from GitHub

#### 2.0 (2015-07-25)

 * Sync with 4.2.3 ( Changeset 33310)
 * Increased minimal WordPress version to 4.2
 * Extending wpdb back again
 * Add ability to extend it with more drivers through the constant ‘WPDB_DRIVERS’
 * Fully compatible with the unit tests of WordPress except HHVM PDO

#### 1.9.3 (2015-05-07)

 * Sync with 4.2.2

#### 1.9.2 (2015-04-27)

 * Sync with 4.2.1

#### 1.9.1 (2015-04-23)

 * Fix setting charset and SQL mode for PDO

#### 1.9 (2015-04-23)

 * Sync to changeset 32261

#### 1.8.1 (2014-08-08)

 * Fix setting charset and SQL mode for PDO

#### 1.8 (2014-08-07)

 * Synced with trunk to Changeset 29165 excluding 27075
    - Ensure compatibility with MySQL 5.6 which has stricter SQL modes by default
    - Throw an incorrect usage notice when the query argument of wpdb::prepare()
      does not include a placeholder.
    - When the MySQL server has “gone away,” attempt to reconnect and retry the 
      query.
 * Don’t extend wpdb anymore to be on the safe side
 * Works with socket connections
 * More abstraction from the main db class to our interface.
 * Added a banner image for WordPress.org. Thanks to Marcel van der Horst

#### 1.7 (2014-01-30)

 * Synced with trunk to Changeset 25703
 * Works when plugins folder has been changed
 * Added network support
 * Security enhanchement when using a network installation
 * Updated readme

#### 1.6 (2013-09-18)

 * Fix returning incorrect number of rows for some queries. Props markmont
 * Add error_handler
 * Trowing doing_it_wrong message for all mysql_* functions

#### 1.5 (2013-08-04)

 * Fix dbDelta() to create tables when the tables do not exists
 * Fix fatal error when database can’t get selected by PDO
 * Fix notices when using MySQLi query() when $this->result isn’t an object
 * When database can’t get selected show the default message instead of installation
   screen

#### 1.4 (2013-08-02)

 * Fix notices due changes in WordPress 3.6.
 * Add SSL support. Props hypertextranch.

#### 1.3 (2013-07-09)

 * Show install button when db.php is different.
 * Don’t show remove button when mysql extension isn’t installed.
 * Compatibility fixes for unit tests.

#### 1.2 (2013-06-30)

 * Added emergency override.
 * Updated readme.

#### 1.1 ( 2013-06-28 )

 * Fixes for MySQLi driver, PDO driver.
 * Uses WP_Filesystem for writing / removing db.php when possible.
 * Added deactivate / uninstall code.

#### 1.0 ( 2013-06-28 )

 * First version that supports PDO and MySQLi. Props kurtpayne and scribu.

## 中繼資料

 *  版本 **2.1.0**
 *  最後更新 **10 年前**
 *  啟用安裝數 **60+**
 *  WordPress 版本需求 ** 4.2.0 或更新版本 **
 *  已測試相容的 WordPress 版本 **4.4.0**
 *  語言
 * [English (US)](https://wordpress.org/plugins/wp-db-driver/)
 * 標籤:
 * [backend](https://tw.wordpress.org/plugins/tags/backend/)[database](https://tw.wordpress.org/plugins/tags/database/)
   [mysql](https://tw.wordpress.org/plugins/tags/mysql/)[PDO](https://tw.wordpress.org/plugins/tags/pdo/)
 *  [進階檢視](https://tw.wordpress.org/plugins/wp-db-driver/advanced/)

## 評分

 5 星，滿分為 5 星

 *  [  7 個 5 星使用者評論     ](https://wordpress.org/support/plugin/wp-db-driver/reviews/?filter=5)
 *  [  0 個 4 星使用者評論     ](https://wordpress.org/support/plugin/wp-db-driver/reviews/?filter=4)
 *  [  0 個 3 星使用者評論     ](https://wordpress.org/support/plugin/wp-db-driver/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/wp-db-driver/reviews/?filter=2)
 *  [  0 個 1 星使用者評論     ](https://wordpress.org/support/plugin/wp-db-driver/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/wp-db-driver/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/wp-db-driver/reviews/)

## 參與者

 *   [ Marko Heijnen ](https://profiles.wordpress.org/markoheijnen/)
 *   [ Kurt Payne ](https://profiles.wordpress.org/kurtpayne/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/wp-db-driver/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](https://markoheijnen.com/donate)