cracker
10-11-2008, 11:52 AM
I have search on this forum as well as doing a fair bit of googling and haven't been able to come up with the solution to my problem. I spent an hour at least trying to compile and run a simple CGI app. I would be extremely grateful if someone would be able to help me out on this as I would really like to run CGI apps.
I found a single topic on the forum regarding how to compile a CGI app with a PHP script. I used the code and the object file gets produced as well as the cgi binary but I get an error when trying to run it:
500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs, fix the problem, then try again.
g++ shows no output even with --pass-exit-codes so it's hard to determine what is going on. :rolleyes:
<?php
echo "compiling...<br>";
shell_exec('g++ -c test.c');
shell_exec('g++ test.o -o ./cgi-bin/test.cgi');
echo "done compiling!";
?>
#include <stdio.h>
#include <stdlib.h>
int main() {
cout << "this is a test";
return 0;
}
I found a single topic on the forum regarding how to compile a CGI app with a PHP script. I used the code and the object file gets produced as well as the cgi binary but I get an error when trying to run it:
500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs, fix the problem, then try again.
g++ shows no output even with --pass-exit-codes so it's hard to determine what is going on. :rolleyes:
<?php
echo "compiling...<br>";
shell_exec('g++ -c test.c');
shell_exec('g++ test.o -o ./cgi-bin/test.cgi');
echo "done compiling!";
?>
#include <stdio.h>
#include <stdlib.h>
int main() {
cout << "this is a test";
return 0;
}