Hi all,
I am trying to run a shell script when a user enters a submit button (after validation of the form data). Below is my code
<code>
echo “<pre>”;
//exec(“sh /var/www/html/generate.sh”, $output);
exec(“sh /var/www/html/generate.sh $Path $ID $domain”, $output);
//$output=exec(dirname(__FILE
echo var_dump($output);
//echo $output;
echo “</pre>”;
</code>
But surprisingly when i type only <code> exec(“sh /var/www/html/generate.sh </code> (I have written the shell script if < 3 command line args it pops out a usage message) am able to see the output.
Output:
array(1) {
[0]=>
string(118) “Usage: /var/www/html/generate.sh <………..>”
}
Also the shell script output is very huge its almost equvalent to a pages content. around 10 paragraphs.
So how do i run a shell script which takes 3 or more command line arguments (these command line arguments are the form data which am taking from $_post from the user input) from a php script ?
Do i need to increase the size of the var_dump() ?? or is there anything am missing here.
Even with shell_exec() no much luck i can run only a script without command line args (i dont know how to run shell_exec() which reads command line arguments and outputs it to a page)
This works (but no command line args)
$output=exec(dirname(__FILE
Anybody knows how to accomplish this taks of running a Shell script with 3 command line arguments which outputs a page of data to the user at the browser ?
Thanks and Regards,
kan