Problem with the fwrite function (not as simple as it sounds though)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hello,
First of all sorry for my english, trying my best :]

The story is: I'm running a small webserver and to monitor the amount of people going trough my pages, I've made a simple counter (storing the data in a text file), no matter the details, the important thing is that it WORKED just the way I wanted it to. Till yesterday evening. Today I noticed that all of the counters, that were modyfied since yesterday, have been blanked. I started looking trough the logs and found a large amount of
 PHP Warning:  fread(): Length parameter must be greater than 0.
which was the expected behaviour when reading an empty file.
After a while of checking, I got to the fact that something's wrong with the fwrite() function.
I've writen a 'test' script only to see if I can write files.
When writing to the /tmp dir, all went fine, but when I tried to write to any of the other directories within my $WWWroot the result was an empty file.
This is the script:

$data="some data";
$file="/wwwroot/file"
$handle=fopen($file,"w");
fwrite($handle,$data);
fflush($handle);
fclose($handle);

And as written above, the output was only an empty "" file /wwwroot/file nothing more. I thought about premissions, but after setting the wwwroot a+rwx, setting the owner and group as the same as the apache server works under I got the idea that's not it.
I reinstalled the apache and php.
Now I'm using httpd-2.1.9 and php-4.4.0 (as a module) but the problem is still there, before I was using httpd-2.1.8, but as I said, the problem appeared out of nowhere, when the server was just running on it's own, without upgrades, patches, config changes, or anything other. In fact all it was doing trough the night was serving the websites and receiving mail.

I runned out of ideas. The logs don't show anything related to this. I tried to enable all debug logging, but despite the fact that I'm receiving now 3 times more info on everything else, there's nothing on the fwrite() attempt or related.

Can anybody help?
If any more data is required on my side, I will gladly cooperate to get the thing solved.

--
Best wishes
Łukasz Hejnak

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux