Wordpress has for a long time, and for good reasons, been locked into using mysql as its database storage engine. There is a good discussion of 'why'
in the codex
But this design choice has ramifications; not least because mysql's implementation of sql is not standard. Even with the use of the EZSQL abstraction layer bundled with Wordpress, this makes plugging in other databases very difficult.
PDO For Wordpress is a step towards eliminating this difficulty. Think about this 'plugin' in four steps:
- the basic layer takes all queries and separates out the variables from the language. It replaces each variable with a placeholder as well as stripping mysql specific 'nasties' like the slash-escaping and backticks.
- then a language specific driver steps in and rewrites the query to use its own native constructs or (in the case of SQLite) pushes the query into some special user-defined functions
- the basic layer then puts it all back together and runs the query, finally ...
- returning the whole thing to the EZSQL abstraction layer so that Wordpress doesn't know that anything has gone awry
See below/other notes for details of known limitations
This plugin is not a simple Wordpress plugin. Beware. You cannot just put the files in plugins and enable through the control panel. This is because the database needs to be connected adn established BEFORE the plugins are loaded.
So ... to install PDO For Wordpress please do the following:
- Step 1:
unzip the files in your wp-content directory. After unzipping the structure should look like this
wp-content\
->plugins\
->themes\
->pdo\
db.php\
index.php[maybe]
The key thing is the presence of the pdo directory and the db.php file in the 'root' of the wp-content directory.
1. Step 2:
Edit your wp-config.php file so that:
this line of code is placed directly after the define('COLLATE',''); line:
define('DB_TYPE', 'sqlite'); //mysql or sqlite`
Note: currently only mysql and sqlite are supported. I hope that more flavours will appear soon.
As part of the general wordpress installation you should define your secret keys too (in wp-config.php).
and that's it. two steps.
The next time you load your wordpress installation it will automatically create the database and take you through the basic Wordpress installation routine.
If you have problems with the installation you should receive a meaningful error messsage. If not, the most common error by far is permissions. You MUST make sure that php can read/write to wp-content/database.