Page 1 of 1

CGI downloads instead of executes

PostPosted: 10. August 2011 13:28
by tier4
Hello. I have a VirtualBox'ed Ubuntu set up with xampp I installed just now. My problem is that when I try to run my cgi script, the browser only downloads the file. There is already a
ScriptAlias /cgi-bin/ "/opt/lampp/cgi-bin/" line in the httpd.conf file by default, so I'm left scratching my head wondering why the file is only being downloaded.
Using htaccess files doesn't seem to work either.

I've also tried this and it doesn't work too:
Code: Select all
<Directory /opt/lampp/cgi-bin/>
Options +ExecCGI
</Directory>


This is the C file I compile into the test.cgi file:
Code: Select all
#include <stdio.h>
#include <stdlib.h>
int main(void){
printf("Content-type:text/html​\n\n");
printf("<html><body>hello world!</body></html>");
return 0;
}


This is the html file I'm using. It is named "mp.html" and is in the folder /opt/lampp/htdocs. I access it through "localhost/mp.html" in the web browser.
Code: Select all
<html><body>
<form action="/cgi-bin/test.cgi">
<input type=submit value='compute'>
</form>
</body></html>


Other possibly useful info:
The permissions of the test.cgi file is -rwxr-xr-x

Re: CGI downloads instead of executes

PostPosted: 11. August 2011 00:02
by JonB
I 'think' its an ownership and/or permissions issue.

the test.cgi might have to be world-executable. I think it comes down to: who owns the process that launches the executable???

just 'thoughts'

Good Luck
8)