Writing Blog

March 7, 2010

Flat-file based PHP CMSs

This is one of a series of articles I posted at my Web Development Blog.
You can view the original version at:

After several unsuccessful attempts to access the MySQL databases that provide the data for the web pages of my main client, I have decided to look into other options that do not require a separate MySQL database that returns errors far too often, with a separate password that nobody knows who’s got it or how to retrieve it, and a separate set of skills outside the realm of most web designers.

To my surprise, since last time I checked on flat-file based PHP Content Management Systems, there have been emerged/developed quite a few (and good) options around this approach that I’m listing below:

CMSimple is simple, small and fast. It writes page data directly to a HTML file on the web server. Configuration files and language files are also saved in .txt format.
CMSimple also offers a wide variety of plug-ins, including many made by third parties.

DokuWiki is wiki software that works on plain text files and thus needs no database. Its syntax is similar to the one used by MediaWiki and its data files remain readable outside the wiki.
It has a generic plugin interface which simplified the development and maintenance of add-ons.
DokuWiki is included in the Linux distributions of Debian and Gentoo Linux.

Pluck allows for easy web page creation for users with little or no programming experience, and does not use a database to store its data.
Pluck also includes a flexible module system, which allows developers to integrate custom functionality into the system. Pluck includes 3 default modules: Albums, Blog and Contact form.

razorCMS is designed to be as small as possible ( around 300 KB including a WYSIWYG – Editor), just enough to be useful on a base install. Then extra functionality can be added as needed via the Blade Pack management system.
Skeleton CMS isn’t really a CMS as much as it is a very simple framework for rapid prototyping. If nothing more, it’s a good structured site model to start building a website with. There is no need for a database and no fancy admin area, but if you’re building a site for a client and you don’t need the power of WordPress this might be exactly what you’re after.

As pointed out, the main advantage of using flat-file (text) files as a database for a PHP driven CMS is that you no longer depend on external software to edit and maintain a part of the CMS, without which the system simply will not run.

But you must keep in mind that although flat-file files are an acceptable solution for small databases, they become sluggish as the database grows because access mode is sequential.
Another disadvantage is their inability to support transactions and probably the biggest concern is Security: A database protects the data from outside intrusion better than a flat file because it provides a security layer of its own.
Having said that, NOTHING that is hosted on a server connected to the Internet is secure and if there are hackers equipped with enough resources who are intent in breaking into your system, they eventually will.

An intermediate solution would be the use of SQLite an Open Source embedded relational database management system contained in a small C programming library that when is linked in it becomes an integral part of the program. The entire database including definitions, tables, indices, and the data itself are stored as a single text file on a host machine.
SQLite is embedded into a growing number of popular applications, such as Mozilla Firefox or Google’s Android OS.

Sounds good to me.
Below some of the CMSs that are able to use SQLite to store their data:

eoCMS (everyone’s Content Management System) uses MySQL or SQLite and php to deliver content in a user-friendly interface.
It features a forum, moderation features, custom 404 pages, personal Messaging , plug-ins, RSS output, ratings, etc.

Frog CMS is an extendable open source content management system designed to use PHP5 along with a MySQL database backend, although it also has support for SQLite. It is actually a port of Radiant, the Ruby on Rails CMS, although Frog has begun to take its own development direction.

FUDforum supports all the standard features you may come to expect from a modern forum with a robust MySQL, PostgreSQL or SQLite back-end, that allows for a virtually unlimited number of messages (up to 2^32 messages).

Habari is a modular, object-oriented blogging platform that supports Multiple users, Multiple sites, Plugins, Importers for Serendipity and WordPress, etc.
Habari prides itself in being standards compliant and more secure than other blogging platforms by making use of PDO and enabling prepared statements for all interactions with the database.

Jaws is a CMS and modular framework that focuses on User and Developer “Friendliness” by providing a simple and powerful framework to hack your own modules.
Lanius CMS comes out of the box with two flatfile database choices (Gladius DB and SQLite), that will work out-of-the-box with both PHP4 and PHP5.

phpSQLiteCMS is based on PHP and SQLite and runs “out of the box”. phpSQLiteCMS uses PDO as database interface, which makes it also possible to run with MySQL.

Serendipity is a PHP based blog and web-based content management system that supports PostgreSQL, MySQL, and SQLite database backends, the Smarty template engine, and a plugin architecture is kept updated by automatically checking the plugin repository online.

The only drawback to this approach in many of the systems above is that they use the PHP Data Objects (PDO) extension, a lightweight, consistent interface for accessing databases in PHP, that although greatly reduces the system’s vulnerability to SQL injection attacks, it does require the new OO features in the core of PHP 5, and so will not run with earlier versions of PHP.



  1. why not make your own? it’s not really that hard. i made my own. if you want a custom styled cms, you gotta make it yourself these days, its hard to find themes that go with the site. with the wordpress.com blogs, its not really your own site, but if you want a site that has a blog, but not for the homepage of the site, thats not really an option with wordpress, pivot or b2.

    Comment by tann98 — July 10, 2010 @ 7:15 PM | Reply

  2. WordPress nowadays has all kinds of options, including having a customized homepage.

    Yes, you can make your own CMS, but what for?
    As you have pointed out, are you going to create the templates as well?
    How about security updates, etc?

    What’s the point, when you have a huge community of excellent developers doing all that and much more for you, for free?

    Comment by rafaelminuesa — September 2, 2010 @ 9:02 AM | Reply

  3. I think that being able to edit code, know where things go, and understand code is a real plus. For other people, like you and MANY others, WordPress would be the best thing to use. Yes, you are correct, the WordPress guys do all the work for you, but do you think that Wikihow or Themeforest use wordpress? Yet, they still do have interaction. I personally think that creating your own is time-taking to start with, but in the end you are better off.

    Comment by tann98 — January 29, 2011 @ 3:01 AM | Reply

  4. How abot PivotX…
    “…Yes, it’s a blogging tool – and a pretty brilliant one if you ask us – but PivotX is also a great tool to maintain more complex websites as well. Its powerful core and flexible template system make it easy for developers to adjust and extend. No matter if you want an easy-to-use, robust blogging tool or are looking to push things to the max – PivotX offers the best of both worlds…”

    Comment by ckindarji — February 1, 2011 @ 12:05 PM | Reply

  5. PivotX is nice…but what about FlatPress?

    Comment by ZyNiX — December 28, 2011 @ 9:11 PM | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: