« | Main | »

Get WordPress 2.2 working with SQLite (Updated: 2.2.2)

This code is no longer maintained.

Please use PDO for Wordpress instead.

This wordpress for sqlite patch is based on tume and havarddahle’s work.
Mysql – Sqlite SQL Parse Code comes from tikiwiki project.

Original Version(For Wordpress 2.0 Only)

The previous version can be found here, based on Hasin’s work, Wordpress for SQLite
(For Wordpress 2.0 Only :( )

This source code is released under the terms of the GNU Public License.

It will never go into the Wordpress release,
but it is REALLY easy to get wordpress working with sqlite.

only SQLite 2(2.8.16) have been tested.
Almost Everything works well.

Chinese version

Requirement

Working PHP installation with SQLite support
(but not PDO_SQLite support)

Installation

Step 1
Download patched wordpress 2.2.2(sqlite), and unzip the file.

Link updated.
patched-wp-222.zip

Step 2:

Modify wp-config.php

There is a sample config.php file present already.
Please use absolute path for database file.

add/modify:

define('DB_FILE', '/var/www/htdocs/wordpress.db'); // The full path of the database

//make sure the directory and the file is **writeable** by the web server

Make sure that
the directory and the file is **writeable** by the web server

if necessary:

chmod 777 (the directory)
chmod 777 (the database file)

Step 3:

Have fun with SQLite.

(You can ignore some warning like this:)
Warning: mysql_get_server_info() [function.mysql-get-server-info]: …
Warning: Cannot modify header information – headers already sent by …

(patch is also available, the patch file)
You need to put db.php into wp-content
and disable unneed mysql check.
(we are going to use SQLite, not mysql :) )

File: wp-admin/upgrade-function.php

Search for: (wp 2.2.1, in line 1103)
function wp_check_mysql_version() {
return; //add this line,we are using sqlite

Known issues:

1 Delete a link in blogroll, it says “Something strange happened. Try refreshing the page.”

Support/Help:

Leave a comment if you have support issues.
Or Tell me if it works, thanks.

If you’d like to support this patch, having a link to this page http://www.fcicq.net/wp/?p=302 link somewhere on your blog is the best way.

友情提示: 请注意文章的时效性与准确性, 作者不对文章的有效性负责.

Tags: ,
Bookmark on del.icio.us
Last Modified: December 21, 2008 at 12:54 pm

« | Main | »

18 Comments

  1. Hans said,

    November 22, 2006 @ 05:45

    Downloaded and trying to install…

  2. Hans said,

    November 22, 2006 @ 06:12

    And yes, after some trouble creating the database and permissions on the db directory I succeeded.

    It works with Lighttpd on a NSLU2 running Debian Etch

    Txs!

  3. sensimilla said,

    November 24, 2006 @ 13:56

    I have finally managed to install on my Asus WL-500gP with Olegs latest firmware using lighttp and php-fcgi. I can login as admin but on almost all admin pages I get:

    ‘You do not have sufficient permissions to access this page.’

    The database looks correct and all files/folders are chmodded to 777.
    It is the same with Hasin’s version.

    Any ideas ?

  4. fcicq said,

    November 24, 2006 @ 18:15

    Make sure your PHP session data dir was correct…
    :)

  5. Fredrik said,

    August 10, 2007 @ 03:23

    Hi!

    I’m trying to use this pathed releas and it seems OK, but!
    I have a problem with the calendar wich gives an error like:

    WordPress database error: [not an error]
    SELECT DISTINCT DAYOFstrftime(“%m”, post_date) FROM wp_posts WHERE strftime(“%m”, post_date) = ‘08′ AND strftime(“%Y”, post_date) = ‘2007′ AND post_type = ‘post’ AND post_status = ‘future’ AND post_date > ‘2007-08-09 21:09:47′;

  6. fcicq said,

    August 10, 2007 @ 10:01

    Bug seemed Fixed, I uploaded a new version.
    You can easily replace db.php (wp-content/db.php) to solve this problem.

  7. Adrian said,

    August 13, 2007 @ 01:45

    This is awesome man maybe you should get this going as a permenant thing.

  8. Fredrik said,

    August 14, 2007 @ 02:15

    Hi Again!

    Thanks for the fix on the calendar.

    Many themes seems to not work with the patch, e.g. Mandingo and Binary Blue.
    These are very common themes, so it would be good if they’re supported.

    I.e. with Binary Blue I get an error like “Warning: Invalid argument supplied for foreach()…”

    /Fredrik

  9. fcicq said,

    August 14, 2007 @ 09:29

    I’ll try Binary Blue first.

    I don’t know, why wordpress handle so bad…

    WP-Binary-Blue-v141/plugins/options.php
    ———————–
    function loadOptions($currentVersion) // LINE 89
    {
    $options = get_option(‘bb_theme_options’);
    $options=unserialize($options); //add this line.
    ———————–

    And, I tried Mandigo, but nothing serious found.
    —-
    Any other themes?

    but i can NOT guarantee all plugins and/or themes work well…

  10. wwg said,

    August 31, 2007 @ 15:48

    Can’t post or edit articles, but I can change my password. What’s wrong ?

  11. fcicq said,

    August 31, 2007 @ 17:14

    Some details? including platform,php/sqlite version please.

  12. wwg said,

    August 31, 2007 @ 18:17

    FreeBSD 6.1, sqlite 2.8.17,lighttpd 1.4.15,php 5.2.3
    Linux i686,sqlite 2.8.17,apache 2.2.4,php 5.2.1

    When I was trying to post , I got:

    Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 355 bytes) in /var/www/mysite/blog/wp-content/db.php on line 246

  13. wwg said,

    August 31, 2007 @ 18:21

    Everything works good except writing.

  14. fcicq said,

    August 31, 2007 @ 19:21

    wp-content/db.php

    $poststmt=''; //this is line 150
    echo "Before parse: $query
    "; //add this line
    $query = $this->parse($query);

    it will help with debugging.
    you can send the error message by email. fcicqbbs_at_gmail_dot_com

  15. Chui’s counterpoint » Blog Archive » Wordpress with Sqlite said,

    September 11, 2007 @ 22:42

    [...] testing out wordpress with sqlite, it seems to work pretty well so far. I’ve got it in a patch file format, and added some [...]

  16. robert said,

    March 25, 2008 @ 17:12

    Hi,

    the download link doesn’t work anymore, any chance of fixing it?

    Thanks!

  17. fcicq said,

    March 25, 2008 @ 19:55

    @robert thanks, fixed.

  18. wade said,

    May 30, 2008 @ 05:48

    good job! but wp4sqlite.zip is not downloadable anymore.

· TrackBack URI