PHP code issue noticed in error_log file

Discussion in 'PHP' started by Pathan, Dec 27, 2011.

  1. #1
    Hello,

    On one of my website I noticed that the directory on which one of the PHP script is installed have very large error_log file but most of the errors in that file are as follows:

    we have the following coding on line 477 to 484

      foreach ($mp3s as $gftkey => $gftrow) {
       $ftimes[$gftkey] = array(filemtime($thecurrentdir.$gftrow),$gftrow);
       $ftimes2[$gftkey] = filemtime($thecurrentdir.$gftrow);
     }
     array_multisort($ftimes2,SORT_DESC,$ftimes);
     foreach ($ftimes as $readd) {
       $newmp3s[] = $readd[1];
     }
    PHP:
    Please help me on this.

    Cordially,
    Pathan
     
    Pathan, Dec 27, 2011 IP
  2. filegrasper

    filegrasper Active Member

    Messages:
    493
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #2
    did the site get problem by this warning?

    and check the logfile for the creation date. this may be the older error which can be ignored.
     
    filegrasper, Dec 27, 2011 IP
  3. Pathan

    Pathan Well-Known Member

    Messages:
    2,196
    Likes Received:
    218
    Best Answers:
    0
    Trophy Points:
    165
    #3
    no we don't have issue with site i mean its working properly but the error_log file sometimes reaches 1GB, and I believe those error writing so frequently can slow down the performance of server. I have updated the above code I hope you noticed the change. and regarding the date yeah we removed the file and it was created again at the same time containing the above error.
     
    Pathan, Dec 27, 2011 IP
  4. filegrasper

    filegrasper Active Member

    Messages:
    493
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #4
    which script you use?
     
    filegrasper, Dec 27, 2011 IP
  5. filegrasper

    filegrasper Active Member

    Messages:
    493
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #5
    in the 479 line replace filemtime($thecurrentdir.$gftrow); with array(filemtime($thecurrentdir.$gftrow),$gftrow);

    and try
     
    filegrasper, Dec 27, 2011 IP
  6. Pathan

    Pathan Well-Known Member

    Messages:
    2,196
    Likes Received:
    218
    Best Answers:
    0
    Trophy Points:
    165
    #6
    Ah i have replaced that code and it seems it worked, as I can't see any further generation of error_log file so is the error message.

    So nice of you.
     
    Pathan, Dec 27, 2011 IP
  7. filegrasper

    filegrasper Active Member

    Messages:
    493
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #7
    welcome mate, for more see my signature :)
     
    filegrasper, Dec 27, 2011 IP
  8. filegrasper

    filegrasper Active Member

    Messages:
    493
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #8
    does this create log file even after deleting?
     
    filegrasper, Dec 27, 2011 IP
  9. Pathan

    Pathan Well-Known Member

    Messages:
    2,196
    Likes Received:
    218
    Best Answers:
    0
    Trophy Points:
    165
    #9
    Ooooops the issue is still intact I just verify it I mean that error_log file is still writing the above mentioned error :(

    Please help.
     
    Pathan, Dec 27, 2011 IP
  10. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #10
    filemtime on some systems doesn't work unless you specify the absolute path instead of the relative path.

    
    filemtime('/home/site/public_html/folder/' . $thecurrentdir.$gftrow)
    
    PHP:
    Additionally, make sure that the file actually exists and that read permission is enabled on the file.
     
    ThePHPMaster, Dec 27, 2011 IP
  11. Pathan

    Pathan Well-Known Member

    Messages:
    2,196
    Likes Received:
    218
    Best Answers:
    0
    Trophy Points:
    165
    #11
    well that issue is still coming, is there any server side solution for this error? We do have full root access to server.

    -Regards.
     
    Pathan, Dec 28, 2011 IP