D
D
Dmitry Vyatkin2015-04-24 19:14:53
PHP
Dmitry Vyatkin, 2015-04-24 19:14:53

How to reset php ssh2_connect function after 30 seconds delay?

There is a script:

$connection = ssh2_connect("$value[ip]",22);
if (ssh2_auth_password($connection, "$value[login]", "$value[password]")) {
  echo "Authentication Successful!\n<br>";
  } else {
  echo "Authentication Failed...\n<br>";

How to do something to stop trying to connect if the connection is delayed for 30 seconds?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DevMan, 2015-05-08
@dim137

It is ssh2_connect that does not know how to timeout.
Use what you can. For example, phpseclib .

E
egor_nullptr, 2015-04-24
@egor_nullptr

No way.

S
sivabur, 2015-04-25
@sivabur

Limit script execution time.
bool set_time_limit ( int $seconds )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question