PostgreSQL for WordPress (PG4WP) gives you the possibility to install and use WordPress with a PostgreSQL database as a backend.
- Run Wordpress on your Existing Postgres Cluster
- Run Wordpress with Georeplication with a Multi-Active Postgres instalation such as EDB Postgres Distributed, or CockroachDB for a highly available and resilient Wordpress Infrastructure
PostgreSQL for Wordpress works by intercepting calls to the mysqli_ driver in wordpress's wpdb class. it replaces calls to mysqli_ with wpsqli_ which then are implemented by the driver files found in this plugin.
This plugin has been tested against
- Wordpress 6.5.3, 6.4.3 (v3 branch)
- Wordpress 6.3.2 (v2 branch)
This plugin requires PHP 8.1 or greater
This plugin has been tested on PostgreSQL 14.2
Plugin | Version | Working |
---|---|---|
Debug Bar | 1.1.4 | Confirmed |
Yoast Duplicate Post | 4.2 | Confirmed |
Theme | Version | Working |
---|---|---|
Twenty Twenty-Four | 1.0 | Confirmed |
Twenty Twenty-Three | 1.2 | Confirmed |
Twenty Twenty-Two | 1.5 | Confirmed |
Twenty Twenty-One | 1.9 | Confirmed |
You have to install PG4WP before configuring your WordPress installation for things to work properly. This is because the database needs to be up and running before any plugin can be loaded.
-
Place your WordPress files in the right place on your web server.
-
Download the latest release From the releases page
-
Unzip the files from PG4WP and put the
pg4wp
directory in your/wp-content
directory. -
Copy the
db.php
from thepg4wp
directory towp-content
You can modify this file to configure the database driver you wish to use Currently you can set 'DB_DRIVER' to 'pgsql' or 'mysql'
You can also activate DEBUG and/or ERROR logs
-
Create
wp-config.php
fromwp-config-sample.php
if it does not already exist (PG4WP does not currently intercept database connection setup). -
Point your Web Browser to your WordPress installation and go through the traditional WordPress installation routine.
Contributions are welcome, please open a pull request with your changes and make sure the tests pass by running the test suite using
./tests/tools/phpunit.phar tests/
If you find a failing scenario please add a test for it, A PR which fixes a scenario but does not include a test will not be accepted.
PG4WP is provided "as-is" with no warranty in the hope it can be useful.
PG4WP is licensed under the GNU GPL v2 or any newer version at your choice.
Code originally by Hawk__ (http://www.hawkix.net/) Modifications by @kevinoid and @mattbucci