1

Just wondering, is there anyway to reuse a ssh connection in abother php script page. like, I open a connection on page A, and I finished ahtorization, but I want to process user command in another script page B, is ther any way to run the command avoid to estanblish another connection?

4 Answers 4

2

@code_burgar: what about mysql_pconnect()?

To the OP: what about replacing all instances of fsockopen() with pfsockopen() in phpseclib, a pure PHP SSH implementation

Sign up to request clarification or add additional context in comments.

Comments

1

Won't work for the same reasons that a MySQL connection opened in one php script wont work in a second one.

Comments

1

No, php closes all the resource handles when it's finished. Even if it didn't, you can't save the state of a resource.

Comments

0

Yes, it can be done if you use OpenSSH to connect to the remote server and use the connection multiplexing feature.

Read the ssh manual pages for the details, specially the ControlMaster entry in ssh_config(5).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.