I really read every answer in this website, but I could not solve my problem.
I want to compile C file via gcc, and after various tests, I didn't get nothing.
Here's my php code:
$filename = "file.c";
$pathfile = exec("readlink -f " . $filename);
$path = str_replace($filename, '', $pathfile);
exec("gcc-4.8 ".$pathfile." -o ".$path."runner.out 2>&1",$output,$status);
print_r($output);
print_r($status);
This is the actual command that php executes:
gcc-4.8 /home/vagrant/sites/test/codetest/file.c -o /home/vagrant/sites/test/codetest/runner.out 2>&1
If I try to execute this line on terminal it works.
And this is the output if I try it via php:
Array ( [0] => gcc-4.8: error trying to exec 'cc1': execvp: No such file or directory ) 1
I can't figure out what's the problem, I also changed the permission of the codetest folder, and the permission to the gcc-4.8 to 777, it still not working.