I'd like to try to see the output of two shell_exec() calls in a .txt file.So i tried this:
$data_server = shell_exec('./c5.0demo -f $username -r');
$errorFile = "error.txt";
$fileopen = fopen($errorfile, 'w') or die ("can't open file");
fwrite($fileopen, $data_server);
$data_server2 = shell_exec('./predictBatch -f $username -r > $username.result');
$fileopen = fopen($errorfile, 'w') or die ("can't open file");
fwrite($fileopen, $data_server2);
The executable "c5.0demo" and "predictBatch" are in the same directory of this PHP's script. The variable $username is retrieved by POST method: $user = $_POST['username']; Being an array i put the value inside another variable by this:
foreach($user as $val)
$username .= $val;
I think this is correct but i don't have "error.txt" inside my directory. Why am i wrong? Thanks for all your support!