Jump to content
Sign in to follow this  

Text (INI) file or database? Which one should I use?

Recommended Posts

Greeting Friends,
I need (an) advice(s) again.

My script run by many users on a network drive. It need access (read and write) to a "log" file. I need to decide
should I use a MySQL database for this log or use a text (INI) file. If the text (INI) file used, it will placed on the network drive that every user
have a write permission.

Few "facts":
1. This log file will have around thousand of records/lines, maybe no more then 10,000 records because I will have my script keep only log for the last 7 days.

2. My script will only need to read and write the last few lines of the file.

3. My script will read and write the log files many many times during execution. I need my script to write to the log file in the real time (not only write when
the script exit).

Honestly to say, I prefer to use a text file, because I dont need to alter/create a database on the server and I dont need to put a MySQL write credential
on the script, but if using a text file is not recommended, I'm going to use the MySQL database.

So, which one should I use?

Thanks a bunch in advance :)

Share this post

Link to post
Share on other sites

The data is easily obtained either INI or SQL. I'm not too familiar with SQL but with the INI you can create/edit by just one line. With security being a problem INI wouldn't be the best way to store the information cause it is easily read. I only say INI because I know more about reading and writing to it than I do SQL.  Other options to at least keep the honest people out is to hide the INI file.  Even when hidden you can read/write to it.

Share this post

Link to post
Share on other sites

@AZJIO: what if using SQL, but actually the file pointer is moving (not stay) while the script running (because it's actively searching for another record/table/database)

@Rogue5099: the log file content will be no secret. Thanks for the idea to let the file in a hidden attribute.

Edited by michaelslamet

Share this post

Link to post
Share on other sites


maybe no more then 10,000 records because

Load on the hard drive will be reduced to 10,000 times.


actively searching

moves the head of the hard disk to the specified position. It is always shorter than rewrite the entire file.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...