Forum Moderators: coopster & phranque

Message Too Old, No Replies

Calling a Unix Script from NT

Calling a Unix Script from NT - Need Help

         

fknaut

9:58 pm on Jan 15, 2003 (gmt 0)

10+ Year Member



How do I call a perl script that is on a UNIX server from a Windows 2000 based Web Server running IIS? I'll be calling it from a form and passing the parameters from the form as well.

dingman

10:08 pm on Jan 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<form action="http://unix.server/path/to/script.pl" ... >

fknaut

1:08 pm on Jan 16, 2003 (gmt 0)

10+ Year Member



Does it require SSI to be enabled on the NT side?

andreasfriedrich

1:14 pm on Jan 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, since you are not doing any SSI.

fknaut

7:33 pm on Jan 20, 2003 (gmt 0)

10+ Year Member



I did a test and it doesn't execute the script, it displays it like this:

#!/usr/local/bin/perl

print "If you get this you rule!\n";

Any ideas on how to execute it on the Web?

dingman

10:09 pm on Jan 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The first two things that come to mind are:

1) make sure the script file is marked as executable
2) if it is, try changing the name to end in .cgi rather than .pl

If those don't work, contact the administrator of the Unix server to find out how to run CGI scripts on that server.

As a side note, I think when you are writing a Perl script you need to output your own HTTP headers, since the server doesn't have any way to know what kind of content you are going to generate, how long it is, and so-forth.

fknaut

8:51 pm on Jan 21, 2003 (gmt 0)

10+ Year Member



It is working, sortof. My html is sending out data, but PERL is not accepting the information in <STDIN>. Any ideas?

dingman

9:21 pm on Jan 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you using method="get" or method="post"? If you want the data on STDIN, you need to use "post".

bcc1234

9:30 pm on Jan 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't use perl, but you might want to make sure that you print a content type as the begining of the response. If apache is not configured to set this info by default - your calls to that url will fail.

fknaut

9:32 pm on Jan 21, 2003 (gmt 0)

10+ Year Member



I'm using POST and Apache is setup on the UNIX box, what needs to be setup and where?

andreasfriedrich

10:19 pm on Jan 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Apache´s tutorial Dynamic Content with CGI [httpd.apache.org] explains both server configuration and how to write simple Perl scripts that get called as CGI scripts.