Jump to content

Recommended Posts

Greetings again all.

 

Ok, I have now successfully figured out how to create / add / edit / delete entries to a single

text file via PHP.

 

Now I am wondering - what is the file size / array upper limit? Basically I created this to be  used as a news / blog updater for my clients and I've thought of a possible issue...

 

Rather than storing each entry in its own file, someone suggested putting it all into an array  with separaters. Sounded good and I finally figured it out - but I got to thinking, what if one of my clients starts getting a huge news or blog reel going? Over time this thing will take  forever to load and process will it not? And most likely crash out... (Seeing as how it loads the  whole file in first, then tags the current file as char sep string onto the new entry - thus  reserving chronological order from top down)

 

What are some options here or perhaps I could create something to auto-archive and start over after a bit? Like file gets over so many K, rename it to something like 'events_2.txt', take the two most recent entries, and start a new 'events.txt'? If so, how would I do a check event for this i.e.  if (filesize > xxx K) {archive code here}

 

Thanks,

John

 

(P.S. - as thanks, if anyone would like the code I created for their own use just ask. 4 separate small files maintain, edit, del and write entries in the text file.)

 

Link to comment
https://forums.phpfreaks.com/topic/154724-php-text-file-limitations/
Share on other sites

Basically I have a *few* clients that are hosting with webhosts that only allow ONE database (ridiculous) and I need that database for user / account information.

 

Specifically the setup problem here is: one database, contains users, account info, newsletter subscription y/n, some tracking info, etc.

 

Therefore: I was looking into a way to make a simple text file system that wouldn't be too messy to setup.

 

It works great the way it is... just worried about when it gets to big like I said. None of the blog / news needs to be secure so text is fine. Just wondering if it's going to get bloated or not...

 

I should take a look at sqlite

its a subset of SQL, but pretty rich.

 

a subset of SQL - just means that there are some features not implemented.

 

SQLite used a flatfile for a database, so be sure to put these files in a non web accessible folder.

 

About only problem u will encounter, is that php5 does come with 2 different versions

SQLite2 - usually built in / as well as PDO interface

SQLite3 - using the PDO interface

 

 

Hm, ok I will do that. I have never messed with SQLite, so now is as good as time as any. If I can make that work, then that will be a great solution for those people limited by the number of databases allowed.

 

Most people I do this stuff for (including my own sites) have at least 5 databses included in even basic hosting packages. So usually it's not a problem.

 

Thanks for the input, and thanks again for everyone's original help pointing me in the right direction on my current scripts.

 

Take care,

John

 

right.  they might have one database, but that's not really a hindrance... you can still make the tables you need.  The only thing would be that since it's all under the same database as whatever they originally had there, things would be able to be cross referenced.  If you really think about it, that might not actually be a bad thing, depending on circumstances..

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.