1
我正在使用Unison在兩臺服務器之間同步文件。我試圖讓PHP在文件上傳後調用它。exec錯誤代碼2
我使用exec
,但它返回的2
exec("/usr/bin/unison /var/www/html/files ssh://a2//var/www/html/files -batch -prefer newer -times -path uploads", $out, $r);
$out
是一個空白陣列的錯誤代碼,$r
是2.什麼是2的錯誤代碼是什麼意思?
P.S.我在命令行上運行了php -a
,並複製並粘貼了該行,並且它工作正常。另外,exec('whoami')
有效(並且與我在命令行上登錄的用戶相同)。
我會建議嘗試使用http://us3.php.net/manual/en/function.popen.php代替exec,看看是否可以讀取正在輸出的實際錯誤。 – sberry
@ sberry2A:老兄!非常感謝! '致命錯誤:創建一致目錄/.unison時出錯:Permission denied [mkdir(/。unison)]'。認爲我可以解決這個問題! –