I am new to php and phpseclib.
I'am planning to write a SSH client as part of my project in php. I'am using phpseclib library.
In my project the public key will be uploaded to a server (router) which only supports openSSH and Putty key format (public key).
I've created the key pairs using puttykeygen
. I wrote a SSH client in php. But after showing loading for some time it shows :
NOTE:I don't think it because of the limited execution time(30 sec)
Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\pages\Net\SSH2.php on line 2699
My code:
<?php
include('Net/SSH2.php');
include('Crypt/RSA.php');
$ssh = new Net_SSH2('remoteip');
$key = new Crypt_RSA();
$key->loadKey(file_get_contents('sshprivatekeyfile'));
if (!$ssh->login('admin', $key)) {
print_r($ssh->getError());
exit('Login Failed');
}
echo $ssh->exec('show clients');/any router commands/*
?>