Home > OS >  Can't use my own user with git via apache/php
Can't use my own user with git via apache/php

Time:06-06

We are working with a legacy php project and trying to pull/push files via apache/php/git.

I'm trying to use git via shell_exec, but it throws this error:

warning: unable to access '/var/lib/apache2/.gitconfig': Permission denied
warning: unable to access '/var/lib/apache2/.config/git/config': Permission denied

I have apache configured to use my own user/group and when I exec:

echo shell_exec('whoami');

It shows my own user.

I think git is trying to use apache user with no reason.

When I use git in console it works normally.

The server is an old SUSE:

Server version: Apache/2.2.10 (Linux/SUSE)
PHP 5.2.14

How I can use git with my user via apache/php?

Any help will be appreciated.

CodePudding user response:

In this old SUSE distro with apache 2.2, I changed HOME var of the init script: /etc/init.d/apache2

#...
#: ${homedir:=/var/lib/$pname}
#...
#HOME=$homedir
HOME=/home/administrator
#...

Thank you @Jay

  • Related