http://qs321.pair.com?node_id=721931


in reply to Re: Getting Apache Version
in thread Getting Apache Version

Damn it - won't work :(
#!/usr/bin/perl # example paths can be: # apachectl # apache2ctl # httpd my $path = 'httpd'; print "Content-Type: text/html \n\n"; print "Perl: " . $] . "<br />"; my $output = `$path -v`; my $output2 = system(qq|$path -v|); print "OUTPUT: ($path -v) " . $output . "<br />"; print "OUTPUT 2: ($path -v, as system()) " . $output2 . "<br />"; my @split = split /:/, $output; if ($split[1] !~ /\d\.\d\.\d/) { print qq|Cant find Apache version <br />|; } else { print qq|$split[1] <br />|; }
..yet all that gives is:
Perl: 5.008004 OUTPUT: (httpd -v) OUTPUT 2: (httpd -v, as system()) -1 Cant find Apache version
Seems that it doesn't like giving the results with `` or system(). Any suggestions? TIA Andy

Replies are listed 'Best First'.
Re^3: Getting Apache Version
by ultranerds (Hermit) on Nov 06, 2008 at 15:22 UTC
    Anyone got any suggestions? :/

    Cheers

    Andy
      I don't see where you check error messages, or check that httpd is in the path and readable and executable by current user