Re: [users@httpd] cgi problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



cgi is not recognized as serversite executable.?
but seen as 'some file..'

check the httpd.conf
i paste this, so you know where to look for

---->
# run by the server when requested rather than as documents sent to the
client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

<IfModule mod_cgid.c>
#
# Additional to mod_cgid.c settings, mod_cgid has Scriptsock <path>
# for setting UNIX socket for communicating with cgid.
#
#Scriptsock            logs/cgisock
</IfModule>

#
# "/usr/local/apache2/cgi-bin" should be changed to whatever your
ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
<----


----- Original Message -----
From: "Ben Kuang" <bensdomain12@xxxxxxxxx>
To: <users@xxxxxxxxxxxxxxxx>
Sent: Sunday, April 17, 2005 8:08 AM
Subject: [users@httpd] cgi problem


Hi:

I am using apache/cgi/c++ to do a school project on a unix machine.

i wrote a c++ program to get user input from the forms and prints it out.

i compiled the program named it hi.cgi and put its path in the action
field of my html form.
But when I enter the form, instead of running or processing the cgi
program, the browser asks me if i wanna download hi.cgi.  I have
already set the permission string of hi.cgi to (chmod 755).  I am
pulling my hair trying to figure out what is wrong.  Any help would be
appreciated.

Below is my cpp program code:

#include <iostream>
using namespace std;

void EncodeURL(char * buff);

int main(){
cout << "content-type: text/html\n\n" << endl;
char * query_string = getenv("QUERY_STRING");
char name[100];
int n = 0;
for(int i=0; query_string[i] != '\0'; i++){
name[i] = query_string[i];
}

//cout << "Content-type: text/html/\n\n" << endl;
cout << "<HTML><HEAD><TITLE>Your name</TITLE></HEAD>\n";
cout << "<BODY>\n";

EncodeURL(name);
for(int i=0; name[i] != '\0'; i++){
cout << name[i];
}

cout << "</BODY></HTML>" << endl;
}

void EncodeURL(char * buff){
int x, y;
char * buff2;
char * hexstr;
for(x=0, y=0; x < strlen(buff); x++, y++){
switch (buff[x]){
/* Convert all + chars to space chars */
case '+':
buff2[y] = ' ';
break;

/* Convert all %xy hex codes into ASCII chars */
case '%':

/* Copy the two bytes following the % */
strncpy(hexstr, &buff[x + 1], 2);

/* Skip over the hex */
x = x + 2;

/* Convert the hex to ASCII */
         /* Prevent user from altering URL delimiter sequence */
         if( ((strcmp(hexstr,"26")==0)) || ((strcmp(hexstr,"3D")==0)) )
            {
            buff2[y]='%';
            y++;
            strcpy(buff2,hexstr);
            y=y+2;
            break;
            }

buff2[y] = (char)strtol(hexstr, NULL, 16);
break;

/* Make an exact copy of anything else */
default:
buff2[y] = buff[x];
break;
}
}

strcpy(buff, buff2);
}

And the link to the form is here:
http://pdc-lab.poly.edu/~rkuang01/index.html
If you type something into the form and press the enter button, the
browser will ask if you wanna save the hi.cgi instead of running it.
Once again, I have set the permission string to 755.  Thanks in
advance for your help.

Best,

Ben

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux