Page 1 of 1
Warning: fopen....
Posted: Mon Sep 12, 2016 9:15 pm
by xcurtx
So my site that has been working for years suddenly generates this error on frontend
Warning: fopen(/web/markr/parfumorigo.hu/system/logs/error.txt) [function.fopen]: failed to open stream: Value too large for defined data type in /web/markr/parfumorigo.hu/system/library/log.php on line 12
Warning: fwrite(): supplied argument is not a valid stream resource in /web/markr/parfumorigo.hu/system/library/log.php on line 14
Warning: fclose(): supplied argument is not a valid stream resource in /web/markr/parfumorigo.hu/system/library/log.php on line 16
After this error the page is displayed below as per normal. I tried looking for this particular problem with no luck here on forums. So could someone give me some info on how to deal with this?
Re: Warning: fopen....
Posted: Mon Sep 12, 2016 9:21 pm
by villagedefrance
It looks like your log file ("error.txt") is full!
You just need to empty it.
Re: Warning: fopen....
Posted: Mon Sep 12, 2016 9:52 pm
by xcurtx
villagedefrance wrote:It looks like your log file ("error.txt") is full!
You just need to empty it.
Unfortunately i already did that, it did not fix the issue.
Re: Warning: fopen....
Posted: Mon Sep 12, 2016 10:00 pm
by villagedefrance
Ok, so is the actual file "error.txt" effectively empty (file size = 0)? ... and the actual file permissions still allowing Read/Write (644 or 777)?
Re: Warning: fopen....
Posted: Mon Sep 12, 2016 10:01 pm
by xcurtx
villagedefrance wrote:Ok, so is the actual file "error.txt" effectively empty (file size = 0)? ... and the actual file permissions still allowing Read/Write (644 or 777)?
Empty txt under system/logs/error.txt, and premissions set to 777
Re: Warning: fopen....
Posted: Mon Sep 12, 2016 10:05 pm
by xcurtx
Re: Warning: fopen....
Posted: Mon Sep 12, 2016 10:33 pm
by villagedefrance
Is your code similar to this in your system/library/log.php file?
Code: Select all
public function write($message) {
$file = DIR_LOGS . $this->filename;
$handle = fopen($file, 'a');
fwrite($handle, date('Y-m-d G:i:s') . ' - ' . print_r($message, true) . "\n");
fclose($handle);
}
Re: Warning: fopen....
Posted: Mon Sep 12, 2016 10:56 pm
by xcurtx
This is the code of the mentioned .php
<?php
class Log {
private $filename;
public function __construct($filename) {
$this->filename = $filename;
}
public function write($message) {
$file = DIR_LOGS . $this->filename;
$handle = fopen($file, 'a+');
fwrite($handle, date('Y-m-d G:i:s') . ' - ' . print_r($message, true) . "\n");
fclose($handle);
}
}
?>
Re: Warning: fopen....
Posted: Tue Sep 13, 2016 5:13 am
by xcurtx
im willing to pay someone to fix it at this point, cant figure out my self...
Re: Warning: fopen....
Posted: Tue Sep 13, 2016 5:26 am
by xcurtx
Just manage to solve the issue by deleting everything contained in the logs folder.
Recreated index.html and error.txt and set up the permission again to 777. Dunno why just deleting the content previously didn't work. But now it's solved.
Re: Warning: fopen....
Posted: Tue Sep 13, 2016 5:51 am
by Cue4cheap
777 isn't good. 755 is better.
Mike