$cmds = array( // this proves that the basic call works 'ssh martin@localhost echo Hallo', // this does not hang 'ssh martin@localhost tar cf /tmp/try.tgz /root/no/files', // this hangs here! 'ssh martin@localhost tar cf /tmp/try.tgz /root', ); foreach ($cmds as $cmd) { echo "\nCMD:".$cmd; flush(); echo "\nPASSTHRU output:\n"; passthru($cmd); echo "\n\nPROC_OPEN started...\n"; flush(); $p = proc_open($cmd, array(0=>array('pipe','r'), 1=>array('pipe','w'), 2=>array('pipe','w')), $pipes); echo "\nSTDOUT output:\n".stream_get_contents($pipes[1]); echo "\nSTDERR output:\n".stream_get_contents($pipes[2])."--------------\n\n\n"; }