I am working on a PHP-application, with which I can connect to a RaspberryPI (running Linux) via SSH2 of the phpseclib. Connecting to a device and getting information over the "ls"- oder "pwd"-commands is working fine.
But now I am trying to create a new environment variable - let's say TEST_VAR - on a device, but this seems not to work.
Following my php-code to try that:
$ssh = new Net_SSH2($host, $port, 10);
if (!$ssh->login($user, $pass)) {
exit("Login Failed");
}
// Test->Show the working directory
echo $ssh->exec("pwd");
// Create an environment variable "TEST_VAR" with the value "Test"
echo $ssh->exec("export TEST_VAR=Test");
// Give the content of the above created variable out
echo $ssh->exec("echo \$TEST_VAR");
The creation of the variable does not work and I can not figure out why - because there are no errors. Is this even possible with the phpseclib?
I would be very thankful for any help and hints.
Regards Simon