troubles starting webalizer from php using a shell script

Discussion in 'Server Operation' started by womd, Nov 8, 2007.

  1. womd

    womd New Member

    hello everybody !

    the story is running with apache2.0.53 on suse9.3.
    .. goal is .. on the webalizer site should be a button which, when pressed initializes a new run of parsing logfiles .....

    this is what i try'd:


    starting at webalizer.conf
    -->

    #Htmlpost defines html code to insert before first <hr>....

    Code:
    HTMLPost <?php include("custom.html); ?>

    -->


    here the custom.html which was included previously.
    -->
    <
    Code:
    ?php 
    
    if(isset($_POST['submit']) AND $_POST['submit'] == "regenerate statistics")
    {
       echo("---");
    
       $scriptname = "do_stats";
    
       if(file_exists($scriptname))
       {
        passthru("./$scriptname",$retval);
    
        echo("retval: $retval <br>");
       }
    }
    ?>
    
    <form name="customform" method="post" action"index.html">
    <input type="submit" name="submit" value"regenerate statistics">
    </form>
    
    

    here the shell script which workes if executed in a shell -> do_stats:
    -->

    #!/bin/sh
    /usr/bin/webailzer -n host -o /output/dir /log/file/1 log/file/2



    the output (if i press this button) is:

    Code:
    Webalizer V2.01-10 (Linux 2.6.11.4-20a-default) English retval: 1 

    .. so the script is called ... but no statistic is generated .... maybee some premissoin problem .. how/where can i track this ? .. where can i find additional information on why this does not work ? .. any hint in which logfile this could be ?
    --<


    thank's for your advice !

    chris
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Take a look at
    Code:
    man webalizer
    Maybe you're calling it with the wrong parameters, or the output directory doesn't exist?
     
  3. womd

    womd New Member

    ....

    yes, .... i did read the manual .. did i miss something ?....
    as i wrote, the script is working , when i call it in a shell .. only if it's executed via apache (webbrowser-form) ...

    ... in some case you might be right ... if i execute webalizer with wrong parameters it produces the same output as i have ... but i only got the first line....

    the thing is ... i dont know where to find the "debug-output" of this action ... apache / messages log does not show ... or i cannot see ....

    any other suggestions
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Then it's most likely a permissions problem...
     
  5. womd

    womd New Member

    ...

    ... jep .. i mentioned this in my first post ....

    i chmod'ed /usr/bin/webalizer , so wwwrun can execute. But still the same.

    should i put a ln -s of webalizer to the webroot ? .. you know how to verify if it is still a premission prob ? - or you gonna "quote" my own statements down and down .... ;)
     
  6. falko

    falko Super Moderator Howtoforge Staff

    A permissions problem can also mean that the Apache user cannot read the logs files or write to the output directory. Please check these permissions as well. You could also try to run Webalizer as the Apache user yourself:
    Code:
    su wwwrun
    Then run Webalizer and see if you get any errors.
     
  7. womd

    womd New Member

    solved - thx

    ... i'm such a noob .... the logfiles had wrong premission. should have checked it bevore !

    thank you falko
     

Share This Page