First off, I know that this is a Perl forum and this really is a Perl question. So, here goes:
I have a PHP web page that calls a Perl script that I have written using Net::SSH::Perl. I have fully tested this and it works just fine from the cli. But, it does not complete when I call it from PHP.
The pertinent code segment that is having trouble is this:
my %params = ( protocol => "2", debug => "true", use_pty => 0 );
print "entering Net:SSH:Perl->new command\n";
$ssh = Net::SSH::Perl->new($serverName, %params);
print "entering SSH->login command\n";
$ssh->login($user, $pass);
print "executing cmd\n";
($out,$err,$exit) = $ssh->cmd("/home/bfdi533/pna_switch.pl $pna_swid $
+pna_mode");
print "*****\n";
print "results:\n$out\n";
Here is the output on the web page:
entering Net:SSH:Perl->new command
entering SSH->login command
Should I be calling this code the way I am?
Should I be trying to write this using mod_perl rather than calling the perl script from a PHP system command?
Any and all help and/or advice would be appreciated.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.