0
我需要通过SSH在服务器B上使用PHP WebPage从服务器A启动Perl脚本。使用PHP WebPage通过SSH在远程服务器上执行Perl脚本
我的命令看起来像:
$cmd_string="ssh [email protected] 'perl path/to/script.pl param1 param2'";
我想内外PHP脚本,但没有发生:
exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd_string, $outputfile, $pidfile));
exec($cmd_string, $output);
通过终端运行此命令工作得很好。
感谢您的帮助
那么你得到什么错误/返回值? – arkascha
你能用php登录到服务器吗? – shivams
SSH连接为用户“用户”自动化为服务器B. 但在error.log中,我得到: '无法创建目录'/var/www/.ssh'。 主机密钥验证失败.' 看起来好像进程是由'www-data'而不是'user'运行的? – Lorenzow