in reply to Re^4: Accessing a C++ compiler through a CGI script
in thread Accessing a C++ compiler through a CGI script

Yeah, when you put it on your server I think (i'm not very good with apache) that your apache path has to be set right. The first server i tested on had the path and permissions all setup. If the path isn't set try changing the file paths to their full path name... /home/var/www/blah/code.cpp and /home/var/www/blah/output.txt in code.cgi. Also make sure apache has permissions to write to that directory.

The 'problem receiving data' error comes when the response back from the script isn't a 200 OK response... which means that the script is probably erroring out giving you a 500 ERROR response. If it is doing that, it's probably due to permission/path issues.

When i put it on this server (2nd server i've put it on) i also noticed when apache ran g++ it didn't have permission to make a .o file. i'm still looking for a work-around for that problem... since g++ always wants to make a .o file. If you do get that error, at least you know it compiled successfully :). On my site i just put in some regexs to clean out the path and and that specific error message when it came up. If you could find another program that just checked the syntax, that should work fine as well... and just sub that in the system command. Hope this helps somewhat. The html file should still be ok.

UPDATE
by the way? so did my site work for you or not? and what do you mean by 'sort of worked' except when compiling?
  • Comment on Re^5: Accessing a C++ compiler through a CGI script

Replies are listed 'Best First'.
Re^6: Accessing a C++ compiler through a CGI script
by Spidy (Chaplain) on Oct 27, 2005 at 21:54 UTC
    Well, it appeared to attempt to compile and such...it just never told me whether it actually worked or not; it always gave me that data issue.

    Also, on my version, I'm having issues with getting it to print to output.txt and code.cpp, something about permissions errors and closed filehandles. Any ideas?

      say your files are in a compiler/ directory.

      "chmod 777 compiler"

      that will give everyone the ability to write to that dir... including apache. Then so long as you have the full path in the code.cgi, apache should at least make those 2 files.