Copy apache logs Ubuntu 7.10

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ratcateme
    New Member
    • Nov 2007
    • 11

    #1

    Copy apache logs Ubuntu 7.10

    Hi i am using php 5.2.3 on Ubuntu 7.10 and apache 2.2.4.
    i have just switched from windows 2000 and have encountered a problem with my log viewer script unlike windows i cannot just open the apache log file with php as it is always being used by apache. now i can copy using command line:
    cp /var/log/apache2/access.log /var/log/apache2/access.log.copy

    I need to do this in php but i don't no how.

    Please help

    Thanks Scott.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Scott.

    Check out the copy() function.

    Comment

    • ratcateme
      New Member
      • Nov 2007
      • 11

      #3
      Thanks for the reply.

      I put this is my code
      [PHP]copy('/var/log/apache2/access.log','/var/log/apache2/access.log.copy ');[/PHP]
      but i gets a error again because the access.log file is in use by apache.
      i dont n o any shell scripting but i think that is what i need to copy this file i tried using this cimmand but i dont think the syntax is correct
      [PHP]$cmd='cp /var/log/apache2/access.log /var/log/apache2/access.log.copy ';
      echo exec($cmd);[/PHP]

      Scott.

      Comment

      Working...