wordpress is one of the very popular blogging platforms which is not only free but also released as a open source project. officially wordpress runs only on mysql. so if you want to run it with SQLite, you will not find any official support for that. but fortunately justin addie has written an excellent plugin (pdo for wordpress) which will work as an adapter just between the wordpress DAL and mysql. this plugin hooks all the SQL queries which are sent to execute on mysql by wordpress, convert those into PDO compatible statements and then execute them. currently PDO for WordPress is written to work smoothly with mysql and sqlite.
on the other hand, WPMU (wordpress mu or multi-user) is another version of wordpress which uses the core wp with some modifications and convert any single user wordpress blog into a multi user blogging platform. in this blog post i will show you how you can convert a general installation of wordpress into multi user blogging platform (like WPMU, but fully featured) and take advantage of SQLite 🙂 – so let the fun begin.
step 1: check if your domain support wildcard A record. if so, then create a “*” A record and point it to your server. if it works, now you can point http://.. to your server 🙂 – that is very much required. alo please check that in your webserver it has “pdo” and “pdo_sqlite” php extensions enabled. you can check that using phpinfo(); – needless to say, you need PHP5
step 2: install wordpress
step 3: install pdo for wordpress
download the pdo_for_wordpress plugin. inside it you will find one file named “db.php” and a folder named “pdo”.
put the db.php inside “wp-content” directory
now put the “pdo” folder inside “wp-content” directory
open wp-config.php
find the following line
[sourcecode lang=”php”]
define(‘DB_COLLATE’, ”);
[/sourcecode]
add the following line just below that line
[sourcecode lang=”php”]
define(‘DB_TYPE’, ‘sqlite’);
[/sourcecode]
step 4: create a directory named “userdb” anywhere in your server, make sure to give it write access. in this example we’ve created one as /opt/userdb – DONT FORGET TO ASSIGN WRITE PERMISSION to this “userdb” directory.
step 5: now we will be modifying that “db.php” which we had copied into “wp-content” folder.
find the line in db.php where it says
[sourcecode lang=”php”]
define (‘FQDBDIR’, ABSPATH .’/wp-content/database/’);
define (‘FQDB’, FQDBDIR .’MyBlog.sqlite’);
[/sourcecode]
now change those lines as below
[sourcecode lang=”php”]
define (‘FQDBDIR’, ‘/opt/userdb/’);
define (‘FQDB’, FQDBDIR ."{$_SERVER[‘SERVER_NAME’]}.sqlite");
[/sourcecode]
and tada – you are done. now point your browser to any subdomain under your domain and it will comeup with registration page. register some blog and check it out 🙂 (at the bottom of this post you can find the link of a live demo)
now you can extract some themes in the wp-content/themes folder or some plug-ins into wp-content/plugins folder. all users will be able to choose only from those pre installed themes and plugins, and everyones data and configuration will remain separate from others, as everyone is running from their own database. set only “read” access to “wp-content/themes” and “wp-content/plugins” folders to avoid any security loophole.
happy blogging.
[note – i’ve checked it against latest wordpress 2.8.4 and it runs okay]
To check out a live example of a running wordpress 2.8.4 on SQLite – click on http://anything.twistats.com/wp/ – and to create your own – just go to this url http://<any_subdomain>.twistats.com/wp and register your one :). You can select from six pre installed themes too 🙂