Best way to empty the PHP error_log file?

Discussion in 'PHP' started by fatabbot, Apr 16, 2007.

  1. #1
    Can it be deleted so it creates a new one automatically?
    Or better to download it, make file empty and re-upload the empty file?
     
    fatabbot, Apr 16, 2007 IP
  2. kids

    kids Active Member

    Messages:
    411
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    68
    #2
    Access denied! I always get this mez when try to delete it!
     
    kids, Apr 16, 2007 IP
  3. designcode

    designcode Well-Known Member

    Messages:
    738
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #3
    Make a script that empty file and put this script on cron, thats it. Script will be,

    $handle = fopen("error_log", w);
    fwrite($handle, " ");

    I have not tested it, but it shud work.
     
    designcode, Apr 16, 2007 IP
  4. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #4
    For that the file should be writable, and we should be knowing the exact path, right?
     
    Aragorn, Apr 16, 2007 IP
  5. designcode

    designcode Well-Known Member

    Messages:
    738
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #5
    Yeh Aragon you are right, I think for emptying php log file you will have to use SUDO.
     
    designcode, Apr 16, 2007 IP
  6. lionheart008

    lionheart008 Guest

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You could always just delete it, It is created new if not found.
     
    lionheart008, Apr 16, 2007 IP