Results 1 to 11 of 11
  1. #1

    flat file php forum

    Well after looking for one for a while (all too big and bloated crap lol). I gave up and started writing one myself. I do need some feedback/testing on it to make sure it doesnt break right away.

    It's very simple at this time, however with time the following things will come: user registration/login (name protection) simple admin features (lock/make sticky/delete msgs/threads) thread email subscription.

    I placed all data files outside (below) public_html, what else should one do when its flat file versus php/mysql? (I do run a homemade php/mysql board on another site that has run extreme well so far- 1500+ threads 5000+ messages - no hacks or anything happened).

    It's at:
    http://greylisting.org/forum/

    Design isn't worked out completely yet. I'll probably give it a grey look eventually.

  2. #2
    Join Date
    Oct 2003
    Posts
    115
    sounds interesting
    can you tell me how fast the pages are loading?

  3. #3
    >>can you tell me how fast the pages are loading?

    Hmm, I dunno. Haven't tried calculating it. However, I would think that, provided the computer has plenty of RAM, a flat file forum is not much slower then a mysql forum (if slower at all). When browsing; data files would stay in memory cache (I think). The biggest problem is the scaleability - lack thereof - if it gets very busy.

  4. #4
    I wrote one that's very small and nonbloated but is also very simple and used a ton of javascript. here it is though...

    http://www.neohz.com/flatforum.zip


    i had a lot of fun building it

  5. #5
    I was thinking of writing one as a college project, it would be ideal for those looking for portability, as it would work under any platform with PHP, and you could back up the forum using one file.

    As stated above the only drawback would be when the forum gets busy, as it would require a lot of HDD reads/writes.

    I wrote a flat-file database class a couple of weeks ago, i might try and implement it into this idea.

  6. #6
    php5 will come with SQLite which is a flatfile database so soon it shouldn;t matter but flatfiles are great for portability and ease of use. I've heard you can break the text file with multiple simultanious accesses so make sure you back them up.

  7. #7
    >>>I've heard you can break the text file with multiple simultanious accesses so make sure you back them up.

    But shouldn't using flock() avoid this? :-) (SYNCHRONIZING access to files, ie. shared read locks for reading, exclusive lock for when you need to update a file)

  8. #8
    Join Date
    Dec 2002
    Location
    NY, NY
    Posts
    3,975
    But its not as good.
    You will spend so much more time on search functions and the like.
    Instead of a simple sql query like:
    "select * from xxx where a = b order by id DESC;
    you would have a hell of alot of code.

  9. #9
    Originally posted by ilyash
    But its not as good.
    You will spend so much more time on search functions and the like.
    Instead of a simple sql query like:
    "select * from xxx where a = b order by id DESC;
    you would have a hell of alot of code.
    Not that much code actually; it would work fine for smaller applications (e.g. Private Forum), as a foreach() loop over an array of lines (Perhaps load the lines in chunks to prevent an overly large memory footprint?) although then for larger applications a fully fledged Database is obviously the right choice.

  10. #10
    Join Date
    Dec 2002
    Location
    NY, NY
    Posts
    3,975
    it would take a whole lot more code.
    And that was only one example.
    There are countless others.
    Like updates, and different cases and such...

  11. #11
    RE: exclusive lock for when you need to update a file

    the problem being that as soon as you start locking files you have essentially made your app single threaded which is a pretty big hit to scalability. Of course if you were thinking scalable you probably wouldn't even consider flat files.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •