Saturday 15 May 2010

PHP calls to git command via system(), fails with exit code 128 -



PHP calls to git command via system(), fails with exit code 128 -

centos 5.9, php 5.4.21, tomcat 7.0.42, safe mode off.

i need commit code repository php. failed exit code 128. codes below, , command_exec 'cd /data/project && git add together .'

ob_start(); $this->system_call_detail = system($this->command_exec, $this->output); $logger->debug('executecmd scheme phone call result : '.$this->system_call_detail); ob_end_clean();

i can run git command apache user business relationship cmd, programs run php fail exit code 128.

i guessed cause php. so, tried git command, "php -r 'system("cd /data/project && git add together .", $test); echo $test;'" cmd apache user business relationship , success.

i solved problem..

first, couldn't contents when run command, because of php bug(?). http://kr1.php.net/manual/en/function.system.php#108713

i fixed command belows:

$this->system_call_detail = system($this->command_exec.' 2>&1', $this->output);

and then, error msgs belows:

fatal: unable access '/home/{username}/.config/git/config': permission denied

but, there no such files or directory. so, googled error msgs. , found blog.

http://www.jethrocarr.com/2013/08/25/the-apache-that-wanted-to-be-root/

and edited '/etc/sysconfig/httpd' file blogs posted. , solved. :)

thank helping me. deceze , ojrask

php git

No comments:

Post a Comment