CGI downloads instead of executes
Posted: 10. August 2011 13:28
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:
This is the C file I compile into the test.cgi file:
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.
Other possibly useful info:
The permissions of the test.cgi file is -rwxr-xr-x
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