Running cgi shell script using slinger

Hi there,

I’m using QNX 6.2.1 and I have some problems with slinger. The problem is that I can’t run cgi shell scripts, althought I’m able to run a compiled cgi file made in c language.

Here is an example of a cgi script:
#!/bin/ksh

script.cgi

echo “Content-type: text/html”
echo “”
echo “Korn shell version”
echo “It is now ‘date’”
echo “The query is $QUERY_STRING”
echo “You are signed onto $REMOTE_HOST”
echo “Your IP Address is $REMOTE_ADDR”
exit 0

The things that I have already done to work it out:

1)Export the variables and run slinger
export HTTPD_ROOT_DIR=/web/www
export HTTPD_ROOT_DOC=index.html
export HTTPD_SCRIPTALIAS=/web/cgi-bin
slinger -des &

2)Permission to exec the script file
chmod 755 script.cgi

Well, is there something else that I’m missing??? I can’t figure out the problem, but I think that migh be simple.

Best regards

#!/bin/sh

script.cgi

echo “Content-type: text/plain”
echo “”
echo “Korn shell version”
echo “It is now ‘date’”
echo “The query is $QUERY_STRING”
echo “You are signed onto $REMOTE_HOST”
echo “Your IP Address is $REMOTE_ADDR”
exit 0

Plus make sure you call 127.0.0.1/cgi-bin/script.cgi/ when you test with the Voyager from local system. Once it works locally check it from other systems but of course using the ip addredss of yours!

Cheers

I made the correction sugested but still doesn’t work. Any more ideas?
I also have a problems to run SSI commands. Does “slinger -des &” and the export variables aren’t enought to run shtml pages???

I created the same dir structure and script, exported HTTP_* variables as in your case and started slinger exactly as you started and it works for me!!
Note: text/plain instead text/html is very important!!

Try also to run your script locally, just go to /web/cgi-bin
and type ./script.cgi. This way you test the script itself, printing to the console what you expect.

Koko,

I don’t understand what’s going on! If u created the same dir struct and exported the same variables, why it doesn’t work for me??? I ran my script localy and it prints what is expected.
It’s very weird. I’m trying to run this scripts at 3 different machines and none of them do what is supposed to do!

Did you check if TCP/IP stack is running and address assigned:
->being logged as root: ifconfig en0
or try ping 127.0.0.1

Yeah, I have full network capability. I can run C compiled cgi files and view html pages in my server, except the cgi shell scripts.

Look,
I can create a tarball file with my script, but really do not know how to upload it here.
You might untar it, but first backup your /web directory. Then start slinger manually as you described me and it should work
Give me your e-mail address and I can attach it for you!
Regards

I’m very thankful for your help koko.
Please, send the file to maeda_1979@yahoo.com. I don’t know what else to do…this problem is freaking me out! hehehehe
I will post the results later!
Regards

You shoud have received my e-mail!

Koko, I did everything u told in the email. But it still doesn’t work. Maybe there is something worng with my QNX…don’t know.

Thanks a lot for your help and time.

Best regards

I started using CGI scripts under QNX years ago, and remember there was something wrong with particular version of slinger, and had similar problems, but unfortunately do not remeber which version

If you have a spare old computer around, it might be worth your while at this point to load QNX on it fresh and try it out. If it works you can suspect something wrong on your current system. If not, you might want to suspect something external. I’m assuming you are accessing slinger over a network.

maeda,
You should check everything locally on the system using local Voyager instance and then other mashines. Guess that is what you did?!?

Finally people,

The problem was my slinger version. I replaced with the version that Koko sent to me and it worked!!!
After 5 day trying to make it work! hehehehehe
I appreciate your help guys, specially Koko, who spent a lot time trying to figure ut the problem!
Best regards

I have the same problem. I can’t run CGI script.

My slinger exe file size is - 39044.
I think I also have wrong version of slinger.
Where can I find correct version? Please help!!!

Hi Maeda,

I am facing some issues with slinger too.
Can you guide me?

The below is foo.html

Hello there!

random.c file

#include <stdio.h>
int main()
{
printf(“Content-type: text/html\n\n”);
printf("\n");
printf("\n");
printf(“

Hello there!

\n”);
printf("\n");
printf("\n");
return 0;
}

I compiled it as:
gcc random.c -o random.cgi

chmod 755 random.cgi

./random.cgi
Content-type: text/html

Hello there!

The things that I have already done is:

Export the variables and run slinger
export HTTPD_ROOT_DIR=/usr/webdoc
export HTTPD_ROOT_DOC=foo.html
export HTTPD_SCRIPTALIAS=/usr/web/cgi-bin
slinger -d &

Regards,

Please don’t post all over the place.