how do you execute ssh commands that has variables in them in php -


i need execute commands on ssh in php. sincere there multiple of servers, have build $file_name each server. file name this: vmstat_servername. below code.

$file_name="/var/vmstat_".$value; 

this command not working because $file_name inside single tikcs. ideas how can make work?

$line1= $ssh->exec('head -3 $file_name'); 

use double quotes, variable evaluated:

$line1= $ssh->exec("head -3 $file_name"); 

Comments