HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   General (
-   -   Error: Warning: fread() [function.fread]: Length parameter ... (

thinkpad 26th April 2012 21:29

Error: Warning: fread() [function.fread]: Length parameter ...
Not really sure if this goes in this forum, or the Apache server forum, but we have a linux mail server, and an online webmail login. Sometimes, when users try to login, they will receive an error reading something like this:

Warning: fread() [function.fread]: Length parameter must be greater
than 0 in /home/admispconfig/ispconfig/web/webmail/inc/lib.php on line

Warning: Cannot modify header information - headers already sent by
(output started at
/home/admispconfig/ispconfig/web/webmail/inc/lib.php:106) in
/home/admispconfig/ispconfig/web/webmail/inc/inc.php on line 103

If I restart the mail server, the issue goes away. It will then resurface within a week or two.

Any ideas, suggestion, or direction?

falko 27th April 2012 13:11

What webmail package do you use? SquirrelMail, RoundCube, etc.?

thinkpad 27th April 2012 14:10

Hi Falko,

Thanks for the response. The mail package is Uebimiau.

falko 28th April 2012 09:37

Can you post the lines around line 106 from /home/admispconfig/ispconfig/web/webmail/inc/lib.php?

thinkpad 30th April 2012 15:27

Hi Falko,

These are lines 70 to 140. Thanks.

PHP Code:

root@mail:/home/admispconfig/ispconfig/web/webmail/inc# sed -n '70,140p' lib.php
function array_qsort2 (&$array$column=0$order="ASC"$first=0$last= -2) {
$last == -2$last count($array) - 1;
$last $first) {
$alpha $first;
$omega $last;
$guess $array[$alpha][$column];
$omega >= $alpha) {
$order == "ASC") {
strtolower($array[$alpha][$column]) < strtolower($guess)) $alpha++;
strtolower($array[$omega][$column]) > strtolower($guess)) $omega--;
                        } else {
strtolower($array[$alpha][$column]) > strtolower($guess)) $alpha++;
strtolower($array[$omega][$column]) < strtolower($guess)) $omega--;
strtolower($alpha) > strtolower($omega)) break;
$temporary $array[$alpha];
$array[$alpha++] = $array[$omega];
$array[$omega--] = $temporary;
array_qsort2 ($array$column$order$first$omega);
array_qsort2 ($array$column$order$alpha$last);

Session {


Load() {
$sessionfile $this->temp_folder."_sessions/".$this->sid.".usf";
$result      = Array();
file_exists($sessionfile)) {
$fp fopen($sessionfile,"rb");
$result fread($fp,filesize($sessionfile));
$result unserialize(base64_decode($result));

Save(&$array2save) {
$content base64_encode(serialize($array2save));
is_writable($this->temp_folder)) die("<h3>The folder \"".$this->temp_folder."\" is not writtable or does not exist!!!</h3>");
$sessiondir $this->temp_folder."_sessions/";
file_exists($sessiondir)) mkdir($sessiondir,0777);
$f fopen("$sessiondir".$this->sid.".usf","wb") or die("<h3>Could not open session file</h3>");
Kill() {
$sessionfile $this->temp_folder."_sessions/".$this->sid.".usf";
                return @

// load settings
function load_prefs() {



$pref_file $userfolder."_infos/prefs.upf"

falko 1st May 2012 15:56


        function Load() {
                $sessionfile = $this->temp_folder."_sessions/".$this->sid.".usf";
                $result      = Array();
                if(file_exists($sessionfile)) {
                        $fp = fopen($sessionfile,"rb");
                        $result = fread($fp,filesize($sessionfile));
                        $result = unserialize(base64_decode($result));
                return $result;

Looks as if the session file exists, but is empty. I think you should delete all session files in the temp folder.

thinkpad 1st May 2012 16:58

Sorry for my ignorance, but sessions files are listed as what?

I'm in home/admispconfig/ispconfig/temp/

And then open the 'webmail' directory. There I find a list of all (or most) of the email users. (ie emailaddress_localhost) Are those what I should delete?

ps there is a lot of ispconfig.log.*.tar.gz files in the ispconfig directory. Are they fine?

thinkpad 7th May 2012 14:01

? bumpppppp

public_domain 8th May 2012 09:04

session is there but empty...
may i suggest to look that your cookies may show that you actually have 2 simultaneous sessions. look at the "PATH" for the sessions. happened to me. reads one, writes another. pretty easy fix.

thinkpad 8th May 2012 21:12

Thanks Public_Domain.

Any additional thoughts Falko?

All times are GMT +2. The time now is 01:23.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.