Hi i am using apache 2.2.4 and php 5.2.3 on Ubuntu server. i have just changed from a windows 2000 server and i have a script for viewing my apache logs.
when i run my script now i get:
Warning: fopen(/var/log/apache2/access.log) [function.fopen]: failed to open stream: Permission denied in /var/www/Admin/log.php on line 16
i have chmod access.log to 777 but i still get the same error.
i am new to linux and cannot work this one out

could you please help
thanks

Scott

    I think it might be because the file is in use. You might make a copy of the log file first, then open the copy.

      thanks for the reply i am trying to develop a script to copy it but i am having some trouble
      php copy gets an error presumably because the file is in use. i am trying to write a shell command that will do this:
      $access_file='/var/log/apache2/access.log';
      $cmd='cp '.$access_file.' '.$access_file.'.copy';
      $handle = popen($cmd, 'r');
      echo "'$handle'; <br />" . gettype($handle) . "\n";
      $read = fread($handle, 2096);
      echo $read;
      pclose($handle);
      it does not get an error but when i check the directory it does not create the new file

        You may have to create a shell script, then call it with an exec() command.

          The problem will be that /var/log is only accessible to root. Opening this up to the world would be considered a big security hole.

            Write a Reply...