I want to pass two values from my PHP code to the shell command line. Something like this:
<?php
$myhost="myhost";
$mydir="mydir";
$runcommand = shell_exec("ssh $myhost du -h $mydir");
echo "<pre>$runcommand</pre>";
?>
I have tested different ways and no luck. If I hard code the values it works like a charm. This:
echo "<pre>$myhost,$mydir</pre>";
Shows both values being passed.
What am I missing?
Thank you for any assistance.
Wayne
$run ="ssh $myhost du -h $mydir"; echo $run; $runcommand = shell_exec($run);$myhostor$mydirvariable in your code. When you run it goes like:ssh du -h. Is that a typo ?echo "<pre>$myhost,$mydir</pre>";works