Error: Warning: fread() [function.fread]: Length parameter ...

Discussion in 'General' started by thinkpad, Apr 26, 2012.

  1. thinkpad

    thinkpad New Member

    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?
  2. falko

    falko Super Moderator Howtoforge Staff

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

    thinkpad New Member

    Hi Falko,

    Thanks for the response. The mail package is Uebimiau.
  4. falko

    falko Super Moderator Howtoforge Staff

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

    thinkpad New Member

    Hi Falko,

    These are lines 70 to 140. Thanks.

    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";
  6. falko

    falko Super Moderator Howtoforge Staff

            function Load() {
                    $sessionfile = $this->temp_folder."_sessions/".$this->sid.".usf";
                    $result      = Array();
                    if(file_exists($sessionfile)) {
                            $fp = fopen($sessionfile,"rb");
                            $result = fread($fp,[B][COLOR="Red"]filesize($sessionfile)[/COLOR][/B]);
                            $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.
  7. thinkpad

    thinkpad New Member

    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?
  8. thinkpad

    thinkpad New Member

    ? bumpppppp
  9. public_domain

    public_domain New Member

    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.
  10. thinkpad

    thinkpad New Member

    Thanks Public_Domain.

    Any additional thoughts Falko?
  11. falko

    falko Super Moderator Howtoforge Staff

    Please delete all .usf files in the /home/admispconfig/ispconfig/temp/webmail/_sessions directory.
  12. thinkpad

    thinkpad New Member

    Thanks for your help. Hopefully that fixes it!
  13. thinkpad

    thinkpad New Member

    Sooo, the problem came back.

    So either a) the above fix didn't work or b) it is only a temporary fix.

    Temporary fix isn't really what I'm looking for b/c simply restarting the mail server does that.

    Any other thoughts?
  14. falko

    falko Super Moderator Howtoforge Staff

    I'm running out of ideas... :(
  15. keybd_user

    keybd_user Member

    Same problem on VM ...


    Long time no talk in this forum ...

    I have the Exact same problem with the same error.

    In my case ispconfig is installed in a Virtual Machine and, that's the problem.
    I get that error when the Small disk is full and the host does not allow me to expand on the disk.

    I made a df -h and the output was strange like this :

    df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/simfs 14G 1.6G 0 100% /
    none 512M 4.0K 512M 1% /dev
    Strange thing I think this is indeed a error related with disk full 1.4Gb used in 14GB available and the usage is 100% ?!?!?.

    I could log onto webmiau but I not see any email on any account ..all blank!
    Also ispconfig admin panel was all empty ... no resellers at all there!

    After complaining with the provider I got the following:

    df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/simfs             14G  1.6G   86M  95% /
    none                  512M  4.0K  512M   1% /dev
    And now I get to see the email and the admin panel but I still have problems in the application.
    Another simple test on the VM that I had no disk space ... likely due to Overselling the VM's ... was a MySql cli interface command returned the error ... no disk space!

    Just using ispconfig db and making

    desc sys_user:
    ERROR 1030 (HY000): Got error 28 from storage engine
    So I am convinced it is a disk space problem on my Virtual Machine server.
    It as nothing to do with Ispconfig.


Share This Page