0
我們從PHP調用一個bash腳本來做一個簡單的git pull。 當我們從終端使用root或apache用戶運行這個腳本時,它執行得很好。 然而,當PHP excecutes使用EXEC腳本它輸出這樣的錯誤:從PHP執行git時何時無法使用代理?
error: Failed to connect to XX.XX.XX.XX: Permission denied while accessing https://[email protected]/somecompany/testproject.git/info/refs
XX.XX.XX.XX的IP地址是我們的http代理解析爲
還打印出用戶和代理配置(如您將在下面的bash腳本見)
PHP:
chdir('/var/www/scripts');
$cmd = './gitBranch.sh 2>&1';
exec($cmd,$currentOutput,$err);
print_r($currentOutput);
BASH:
#!/bin/bash
cd /var/www/gitManagedPackages/testproject
whoami #to verify it's the apache user
git config --get http.proxy #to verify it has the proper proxy setting
git pull
當運行腳本apache用戶[蘇-c ./gitBranch.sh -s/bin/sh的阿帕奇]
apache
http://someproxy.somecompany.net:8181
Already up-to-date.
爲什麼從PHP運行時,它會失敗?它以apache用戶身份執行並具有正確的代理集。
並在代理服務器上有一個密碼? – 2014-09-12 20:52:27
根本沒有密碼。如果是這樣,我想從終端上運行腳本時它不起作用嗎? – Sean256 2014-09-12 21:00:47