Execute Perl script on a remote server through SSH with PHP WebPage -


i need launch perl script on server b server php webpage through ssh.

my command looks like:

$cmd_string="ssh user@serverb 'perl path/to/script.pl param1 param2'"; 

i tried both inside php script nothing happen:

exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd_string, $outputfile, $pidfile)); exec($cmd_string, $output); 

running command through terminal works well.

thanks help

my recommendation - use phpseclib, php ssh implementation:

<?php include('net/ssh2.php');  $ssh = new net_ssh2('www.domain.tld'); if (!$ssh->login('username', 'password')) {     exit('login failed'); }  echo $ssh->exec('perl path/to/script.pl param1 param2'); ?> 

exec() disabled on hosts security reasons.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -