#22946 [NoF->Bgs]: exec() or system() or passthru() hang when using openssh 3.4

From: Date: Fri, 11 Mar 2005 23:43:33 +0000
Subject: #22946 [NoF->Bgs]: exec() or system() or passthru() hang when using openssh 3.4
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-77169@lists.php.net to get a copy of this message
ID: 22946 Updated by: rasmus@php.net Reported By: massimo at tuxel dot com -Status: No Feedback +Status: Bogus Bug Type: Program Execution Operating System: SuSE Linux 8.1 PHP Version: 4.3.1 New Comment: scp is non-interactive, so it works fine in batch mode like that. ssh is interactive and as such requires a controlling tty. So it would likely work from PHP running in a TTY in CLI mode, but not from Apache since there is no underlying tty for ssh to attach to. This is in no way a PHP bug. Previous Comments: ------------------------------------------------------------------------ [2005-03-10 04:57:03] ross at rbecker dot org One more note here- I'm aware that there is a PECL extension to add ssh functionality to PHP. I would much prefer NOT to use that extension as it is dependant on a 3rd party library, not actual openssh code, so utilizing this library would create a dependancy on something my vendor does not support or provide bug/security fixes for. I'd much prefer to utilize what exists on the system. ------------------------------------------------------------------------ [2005-03-10 04:24:29] ross at rbecker dot org I am experiencing this same issue on SuSE 9.1 with PHP 4.3.4 and OpenSSH 3.8. This is a more recent PHP than the one you offered up to solve the problem. I have narrowed it down to exec'ing ssh specifically. I am using passwordless public/private key authentication to a user account with very limited priveledges on the remote host. The ssh command to the remote host is actually executed, but PHP never comes back. The problem occurs using system(),shell_exec(), and popen(). I have reproduced this with a script as simple as: <?php system("ssh user@host mycommand_with_no_output"); ?> HTML GOES HERE The result is that PHP never comes back, and it does not error out either. Executing this via the command line works fine, executing it as a web-script hangs permanently. ------------------------------------------------------------------------ [2003-04-21 09:19:43] sniper@php.net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2003-04-09 16:48:52] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-03-28 18:27:02] massimo at tuxel dot com Using ssh through the various exec functions usually hangs php execution. Very strange that: exec('/usr/bin/scp foo@bar.com:/what/ever/file .') works fine, while exec('/usr/bin/ssh foo@bar.com /what/ever/execfile'), where "execfile" is any executable file, makes the execution of the php script hang. Any help/reproduction/confirmation of this very appreciated. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22946&edit=1

« previous php.bugs (#77169) next »