Forum Moderators: coopster & phranque

Message Too Old, No Replies

Perl/CGI scripts working with WebSitePro

         

blackatom

4:57 pm on Aug 1, 2005 (gmt 0)

10+ Year Member



I have recently been asked to set up some Perl scripts on a webserver. The webserver is WebSitePro and the OS is WinNT. I am having some trouble with WebSitePro, as I am not familiar with it. Whenenver I call my .pl file from an html page, I get errors such as this:

501 Not Implemented
Cannot do POST is supported via CGI/API programs only. with this URL /clienttracker.pl.
Most likely, this was an attempt to execute a CGI program located in an area not configured to hold executable CGI programs. Please contact the server administrator at

I assume that I put the script into the cgi-win directory. Does anyone have any ideas? Need more information?
Thanks,
Eric

lZakl

11:30 pm on Aug 1, 2005 (gmt 0)

10+ Year Member



shebang line?

#!/usr/local/bin/perl /*or what ever*/

Are you sure it is correct?

-- Zak

blackatom

1:13 pm on Aug 2, 2005 (gmt 0)

10+ Year Member



I have checked the shebang line and it is correct. I get that error message when I attempt to run the script with arguments( using POST ). If I call the script without arguments, the script executes, but in a command window, and the output is not redirected to the browser. I have checked all the details, and the content-type is correct, etc.

WWMike

5:33 pm on Aug 2, 2005 (gmt 0)

10+ Year Member



Well, I have no idea what WebSitePro is and you're not running Apache so I'm way out of my element but here are my thoughts...

A quick search on "501 error" provides a number of similar problems mentioning domain and IP issues on Win-NT. Check that out.

I suspect that your script is terminating early when it receives no parameters and doesn't even run the code that produces the error.

Your script may also be written to accept GET but not POST.

My suggestion is to run that script from the browser to eliminate the command window and output redirection issues.

Run it with no parameters first:

[domain.com...]

Then run it with command line parameters:

[domain.com...]

Then try to POST to it from an HTML form.

The standard PERL code to accept a POST is:

sub ParseForm {
read ( STDIN, $buffer, $ENV{'CONTENT_LENGTH'} );
@pairs = split( /&/, $buffer );
foreach $pair ( @pairs ) {
( $name, $value ) = split( /=/, $pair );
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/~!/ ~!/g;
$form{$name} = $value;
}
}

Check if something like that is in there.

If all that fails to enlighten you...

One brute-force method for identifying the line that's causing an error in a third-party script is "DROP the STOP":

print "Content-type: text/html\n\nOK\n\n"; exit;

Systematically move that line down your script and keep running it until you get the error.

The bad line will be just above it.

rocknbil

7:49 pm on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Winnt and 2K server are different animals than Linux. For one, you don't **really** even need the #!. You can't set permissions. Et cetera et cetera. Have you contacted the system admin, is this directory DEEFINATELY set for executable, and for what extensions? The error returned may actually be of value in this case.

blackatom

9:11 pm on Aug 2, 2005 (gmt 0)

10+ Year Member



It's WINNT that it's running on. The Administrator is no longer around and nobody seems to know how this thing actually works. Am I to assume that there is nobody out there who knows how this webserver works?

abbeyvet

9:25 pm on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



websitepro is not a server methinks, but a host.

blackatom

9:34 pm on Aug 2, 2005 (gmt 0)

10+ Year Member



It's definitely a web server. At least that's what this O'reilly book tells me. And apparenlty O'reilly distributed the software way back in 1997.

roscoepico

12:49 am on Aug 3, 2005 (gmt 0)

10+ Year Member



It is a webserver, a quick search on google groups for

website pro perl [groups-beta.google.com]

shows a ton of old discussions of people having issues getting perl scripts to work with this webserver.

rocknbil

7:35 pm on Aug 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



there is nobody out there who knows how this webserver works?

Regrettably I've had LOTS of experience with them, but the problem is it's too complex to communicate what you need to do in a post. Plus there are things I'd rather forget. :-)

Either you have to be an administrator or able to VNC into the box. Dig around long enough and you'll find setup areas/programs for managing the domains and specifically the properties and directories of each domain. Once you find it, it's like any other windows program, you right-click the object to access properties (be it a domain or directory) and set permissions accordingly. There's a GUI somewhere where you also determine WHICH extensions are executable as scripts. I think that's the absolute worst part about trying to develop on a Windblows server, from FTP you have no ability to control permissions, it has to be done by an admin.

Mail presents some . . . issues as well.

Sorry for not having more, but a lot of it has faded in memory.

blackatom

4:17 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



Thanks to all who attempted to help. I have figured it out after some poking around. In Server Properties on the Mapping tab. The file extensions need to be mapped to the executable. Also, the cgi-bin folder needs to be mapped. Also the server needs to told which cgi shell to use in order to execute the script.

The server does not report syntax errors in your code the way Apache would, so if your code still has problems you will need to turn on logging and attempt to decode what went wrong from the output( if there is any ).