We have built a code to compile C program from text area built in PHP. We have tried all the commands that could be used to compile the program,
for example exec(), system() and even the shell_exec() commands.
The problem is still that we are not getting the output. We are sending you the code, Kindly please suggest some solution.
<?php
echo "hi its me lalit kumar mishra";
$t1=$_GET; // $t1 is file name of user file.
$t2=$t1;
$t2 .= '.o'; // we are creating the filename with .o extension
$j="cd /home/wipro;"; // where the program exist.
$s ="$j"." gcc -c $t1"; // t1 is user filename with .c extension
$ss="$j"." gcc -o $t2 $t1"; // t2 is filename with .o extension
$sss="$j"." ./$t2"; // getting output of c program
exec($s);
exec($ss);
$var1=exec($sss);
echo "Output of Program= $var1";
?>