|No such thing as a small change
Re: How Would I access a C++ compiler remotely through a Perl CGI Script?by schweini (Friar)
|on Oct 21, 2005 at 20:52 UTC
Well, since you don't seem to want to do this over SSH/scp/FTP, let me just point out that it is very easy to do this. Just store the received form data in some file, compile, redirect STDERR and STDIN to some other file or program, and return that to the browser.
Whether your apache is authorized to access any files gcc might need depends on your system, but usually apache is configured to have as few privileges as possible, so you might want your CGI script to call some other, non-CGI script via 'sudo'. That way, you can easily and securely define just exactly what permissions you want to give the script that's going to compile your script, without altering apache's config or access-privileges. Just make sure to include "NOPASSWD" in your sudoers file, and put your CGI script in some password-protected zone (using .htaccess, for example), because letting strangers compile stuff on your machine doesn't sound as a goog idea.