I can't get output from executable file (a.out) via php. my php code is :
$file = "/path/main.cpp";
$command="cd $path && c++ -lm ".$file;
exec($command);
$output = exec("cd $path && ./a.out");
exec("cd $path && ./a.out > res.txt");
var_dump($output);
all commands is executed but, I'm getting empty value;
exec("cd $path && ./a.out > res.txt");
this command also executed, res.txt was created in folder, but empty file. How to solve this problem? My OS is CentOS 7