K
karraso
Hello,
It is my first post to this group, any way.
I wrote script in perl and it is working fine with cmdline, but in cgi it doesn't.
The browser doesn't print any outputs.
###################################################
open(wynik, ">plik.txt");
use Net::SSH qw(sshopen2);
$user = "user";
$host = "host";
$cmd = "/bin/bash";
@commands = ('ls -l');
sshopen2("$user\@$host", *READER, *WRITER, "$cmd") || die "ssh: $!";
foreach(@commands) {
print WRITER "$_ && echo DDDOOONNNEEE\n";
while (<READER>) {
chomp();
push (@tablica, $_);
last if /DDDOOONNNEEE/;
print "$_\n";
}
}
print wynik "@tablica";
And @tablica is empty when I use cgi. With cmdline the script is working fine, all data are included in @ and in file.
I'm using apache serwer, so maybe there is a problem with userid or access to private key on my pc.
Could you tell me where is the problem? How can I fix it?
BR
karraso
It is my first post to this group, any way.
I wrote script in perl and it is working fine with cmdline, but in cgi it doesn't.
The browser doesn't print any outputs.
###################################################
open(wynik, ">plik.txt");
use Net::SSH qw(sshopen2);
$user = "user";
$host = "host";
$cmd = "/bin/bash";
@commands = ('ls -l');
sshopen2("$user\@$host", *READER, *WRITER, "$cmd") || die "ssh: $!";
foreach(@commands) {
print WRITER "$_ && echo DDDOOONNNEEE\n";
while (<READER>) {
chomp();
push (@tablica, $_);
last if /DDDOOONNNEEE/;
print "$_\n";
}
}
print wynik "@tablica";
And @tablica is empty when I use cgi. With cmdline the script is working fine, all data are included in @ and in file.
I'm using apache serwer, so maybe there is a problem with userid or access to private key on my pc.
Could you tell me where is the problem? How can I fix it?
BR
karraso