47 users online (0 members and 47 guests)  


  Results 1 to 3 of 3

Related

  1. open url from text box? pls help    Forum: Javascript Forum
    Replies: 69
  2. how to open save/open dialog using HTML    Forum: HTML Forum
    Replies: 1
  3. HTTP_POST_FILE can't open    Forum: CGI Perl Forum
    Replies: 0
  4. open url from text box    Forum: Javascript Forum
    Replies: 5
  1. #1
    sunny_cs's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2006
    Posts
    2

    cannot open /var/log/httpd/access_log

    hi..
    this is a small program to print the visitoe count in web browser(firefox)

    html file
    <html>
    <body>
    <a href="http://localhost/cgi-bin/visitor.pl>
    click here</a>
    </body></html>

    perl file
    #!/usr/bin/perl
    use CGI qw/:standard/;
    print "content-type:text/html","\n\n";
    open(fh,"/var/log/httpd/access_log");
    @all_lines=<fh>;
    $count=@all_lines;
    print "<html><body>
    print "no of visitor",$count;
    print "</body></html>";

    in this program i am able to get the ouptut in terminal(console) but not in web browser... getting answer as 0 in web browser...

    can anyone help?????
    thnks

  2. #2
    ALL's Avatar
    Super Dooper Nerd

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382

    Re: cannot open /var/log/httpd/access_log

    if i had to take a guess it is because when you are running it in console you are running the script under your username, when you are running it on the web it is running under another user. A way to fix this is to change the chmod to 755 or 777 of that file.

    also, it is not uncommon for the perl user to be chrooted to a very spacific directory, it may not have access to that directory.

    a way to test this is to list all the files at "/" and see if it is the same as the files in the physical "/" dir.

    If that is the case what you should do is setup a linking or virtual directory to a directory perl can access using something like the ln command.

    -ALL

  3. #3
    sunny_cs's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2006
    Posts
    2

    Re: cannot open /var/log/httpd/access_log

    thanks for replying..
    but i have figured out how to do it..
    i disable the firewall... and it start working...