-
-
Notifications
You must be signed in to change notification settings - Fork 84
Closed
Description
Could you share host or server requirements for using this library? Is a php ssh extension required?
On our host env we have ssh:
$ whereis ssh
ssh: /usr/bin/ssh /etc/ssh /usr/share/man/man1/ssh.1.gz
But on a web page on the host we do not. For example:
<?php
/***
* https://..../test.php
*/
echo exec("which ssh");
// No output.
Similar results after installing the library. The Process result is statuscode 127, command not found:
<?php
namespace Drupal\my_test\Controller;
use GuzzleHttp\ClientInterface;
use Symfony\Component\Process\Process;
use Spatie\Ssh\Ssh;
/**
* Fetch a token.
*/
class GetSSHToken {
/**
* Fetch the SSH result.
*/
public static function test() {
dump([
exec("ssh"),
exec("which ssh"),
]);
$process = Ssh::create($sshUser, $sshHost)
->usePort($sshPort)
->usePrivateKey($sshKeyPath)
->disableStrictHostKeyChecking()
->execute('token');
dump([
$process,
$process->isSuccessful(),
$process->getOutput(),
]);
$process = Ssh::create($sshUser, $sshHost)
->usePort($sshPort)
->usePrivateKey($sshKeyPath)
->disableStrictHostKeyChecking()
->execute('token');
dump([
$process,
$process->isSuccessful(),
$process->getOutput(),
]);
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels