hi
I have a very simmilar problem. I am trying to compile c++ program using g++ compiler. I want to display the errors produced on php page after compilation of the c++ program. I tried using passthru() as below:
$ch = chdir("/asp2/csci111/assignment1/");
$rt = passthru("usr/bin/g++ a1.cpp");
i have given all the permissions (777) to test it. it does not do anything. i can however execute other commands as below.
// correctly displays the file a1.cpp in php page
$rt = passthru("less a1.cpp");
I am wondering if the errors produced by g++ compiler are actually standard output or if they are produced using cerr<< "error" would they need to be redirected to php page differently??
i also tried doing the following to store the output to a file including errors.. it works when i am on the prompt and am super user as httpd but when i am su as nobody on prompt, it does not work. It also does not work from the php page.
g++ a2.cpp >& put.txt
So what is the best way to get the compile errors produced from a program and store them in a file and display them on php page???
Any help would be greatly greatly appreciated.
thanks
Waqas
hi
I have a very simmilar problem. I am trying to compile c++ program using g++ compiler. I want to display the errors produced on php page after compilation of the c++ program. I tried using passthru() as below:
$ch = chdir("/asp2/csci111/assignment1/");
$rt = passthru("usr/bin/g++ a1.cpp");
i have given all the permissions (777) to test it. it does not do anything. i can however execute other commands as below.
// correctly displays the file a1.cpp in php page
$rt = passthru("less a1.cpp");
I am wondering if the errors produced by g++ compiler are actually standard output or if they are produced using cerr<< "error" would they need to be redirected to php page differently??
i also tried doing the following to store the output to a file including errors.. it works when i am on the prompt and am super user as httpd but when i am su as nobody on prompt, it does not work. It also does not work from the php page.
g++ a2.cpp >& put.txt
So what is the best way to get the compile errors produced from a program and store them in a file and display them on php page???
Any help would be greatly greatly appreciated.
thanks
Waqas