Not sure if this is a unix problem or php, but I'm
posting here:
I'm trying to create a web based c++ compiler
for my computer science students. This will
allow them to submit small c++ programs and
view the errors or the output.
They type their code into a text box and when
submitted, I write there code to a file and
then attempt to compile it with a call to g++
using the system() function or ` backtick operator.
Simple unix commands work, like the following:
$command = more hello.txt;
echo"$command";
or
$command = ls -l;
echo"<pre>$command</pre>";
or
system("ls -l");
But the following will not work:
system("g++ hello.c >& err.out");
or
$command=g++ hello.c >& err.out;
echo"<pre>$command</pre>";
the ">&" forces the output to a file called err.out
wich gets created when ran from the command
line, but not when called from php.
I don't think it's a simple file permissions problem, played
that angle for a while.
Can this be fixed with php or is this more an administration
problem? or what?
thanks in advance