File opening using a+

General discussions related to php

Moderators: macek, egami, gesf

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

File opening using a+

Postby eyewoo » 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?

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

Re: File opening using a+

Postby WiZARD » 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

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

Postby eyewoo » 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...

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

Postby Redcircle » 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:

Postby eyewoo » 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... :)

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

Postby Redcircle » Tue May 20, 2003 8:32 pm

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


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest