File opening using a+

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
eyewoo
New php-forum User
New php-forum User
Posts: 71
Joined: Sun Mar 09, 2003 10:29 am
Location: Pennsylvania, USA
Contact:

Thu May 08, 2003 8:26 am

A question related to the amount of time it takes to open and write to a text file using fopen($fileName,'a+').

Regarding the amount of time taken to append a line of text (as with a log file), does the size of the file being opened make any difference when a+ is being used like so: open, write, and then close?
Philip Williams
Image

User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Sun May 18, 2003 12:28 am

Hi
if to you need some like log system see that
http://www.devshed.com/Server_Side/PHP/ ... page1.html
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

eyewoo
New php-forum User
New php-forum User
Posts: 71
Joined: Sun Mar 09, 2003 10:29 am
Location: Pennsylvania, USA
Contact:

Sun May 18, 2003 5:29 am

Hi WiZARD... Nope... my logging system works fine. It's set to a preference number of days. The log file grows until the limit is reached. Then the first visitor that pushes the log over the number of days triggers a routine that slices off the oldest day. From that point on the log does not grow larger than the preference number of days. It will grow or decrease slightly depending on how many visitors there are on a given day, but that is no problem.

At any rate, my question is about the amount of time it takes to append a new text line (a line of log) to a text file. Does the size of the file make any significant difference in the open, append, close operation?

Currently my website log file is set to 30 days. In that time it grows to about a half gig... hence my concern about how long it takes to add a line. If I set it for 10 days, it would be a much smaller line... however, if I set it for 100 days... would that really slow things down??? You get the drift...
Philip Williams
Image

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Tue May 20, 2003 1:19 am

the best education is through trial and error.

try it an see :)

eyewoo
New php-forum User
New php-forum User
Posts: 71
Joined: Sun Mar 09, 2003 10:29 am
Location: Pennsylvania, USA
Contact:

Tue May 20, 2003 6:02 am

So I guess the answer is unknown...

Trial and error... agreed. I've been programing in several languages since 1984... works every time... so do questions asked in forums.... most of the time... :)
Philip Williams
Image

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Tue May 20, 2003 8:32 pm

I usually use databases over flat files. Much easier to work with.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest