php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58455 Persistent ssh connection
Submitted: 2008-12-11 08:22 UTC Modified: 2012-10-07 19:56 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: caddozzone at gmail dot com Assigned:
Status: Open Package: ssh2 (PECL)
PHP Version: any OS: any
Private report: No CVE-ID: None
 [2008-12-11 08:22 UTC] caddozzone at gmail dot com
Description:
------------
I think that the team can build a "persistent connection" feature, like 'mysql_pconnect' do.
It can be useful in ajax programs, which must send commands to an ssh server.
At the end of a php script, the connection resource is closed by the garbage collector, and it's not so simple to mantain an authenticated connection alive.
Now, every time a software must do a new connection, new authentication, with a couple of time lost.

Thanks for your patience.
I hope this submission can be useful.

Regards.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-07 09:11 UTC] paradoxmdb at gmail dot com
I think this is a great idea and I am in need of this too. One 
would be able to create a terminal for example in a web 
interface (using ajax as mentioned) to send and receive 
commands to various servers.

What are the chances of this being accomplished and if 
possible, when would one be able to implement such a 
feature/additional command to the library?
 [2011-08-09 02:26 UTC] radko dot dinev at gmail dot com
I really need this too.
I'd be very grateful if someone implemented it.
 [2012-10-07 19:56 UTC] langemeijer@php.net
-Operating System: every +Operating System: any -PHP Version: HEAD CVS-2008-12-11 (dev) +PHP Version: any
 [2012-10-07 19:56 UTC] langemeijer@php.net
I think that this is a very scary feature request. I understand why you would 
like this, the overhead of connecting to a ssh server is big, but:

How will you be sure the connection you've created to a server will not be hi-
jacked by another PHP process that has no business there?

I've needed something like this. I wrote a background process that does all the 
ssh stuff, with an interface to the application.  My php apache processes talk to 
that background process, not to ssh directly. Also, the php apache scripts don't 
execute freeform shell commands, they only call specific functions in the 
background process.
As an added bonus: the background process can do larger tasks that would not fit 
in a http request (that needs to be short).
 [2014-11-20 09:37 UTC] jpswade at gmail dot com
This bug has been open for a very long time...

The solution is outlined here:
http://stackoverflow.com/questions/15390159/pfsockopen-doesnt-seem-to-be-working

Although this is for a pure PHP solution, I'm sure the concept can be adapted.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 01:01:33 2024 UTC