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


in reply to using Git::Wrapper with Apache

When you run the script at the command line, git is using your account and permissions. When you are executing the script through a browser, it is using whatever user, permissions and environment variables, like path, are set up for the apache server.

Maybe you need to pass the path to the git binary location, as that might not be in the environment variables used by apache:

my $git = Git::Wrapper->new({ dir => '/path/to/repo' , git_binary => +'/path/to/git' });

Anne

Replies are listed 'Best First'.
Re^2: using Git::Wrapper with Apache
by tomgracey (Beadle) on Jun 12, 2013 at 13:48 UTC

    james2vegas and Anne, thanks for your suggestions. Pretty sure its not the path, they look essentially the same either way - however to be extra sure I tried setting it at the beginning of the program

    $ENV{'PATH'} = ...

    the result was the same.

    I have previously also tried specifying 'git_binary' as you suggested

    my $git = Git::Wrapper->new({ dir => '/path/to/repo' , git_binary => ' +/path/to/git' });

    which gives me the same: works on the command line, but falls over

    [error] open3: exec of git version failed at /usr/local/share/perl5/Gi +t/Wrapper.pm line 112

    in the browser.

    Perhaps it is one of the other environment variables - but no idea which one! I will have a look. Thanks for your help anyway.

    EDIT: forgot to mention, apache is not chrooted

      This node 1034122 has instructions on how to determine exactly which environment variables and paths are used at the command line and by apache.

      HTH

      Anne

        For the record in the end I managed to fix this. After many false starts I went back to ground level and reinstalled git itself (it was not an easy process for various reasons) - anyway turns out we were running a broken install. With a fresh version everything appears to work.

        Lesson being - if the error message is "not available or broken" and you know its available - consider the possibility of it actually being broken!!

        Not in fact a Perl problem - apologies for the red herring