Solved

Cgi Scrpits and Windows Srver 2003 and IIS 6.0

Posted on 2004-10-25
283 Views
Last Modified: 2013-11-18
I am running Windows Server 2003, with Active Perl 5.8.3. A customer has a "cgi" script that is not running properly. The exact error can be seen at http://www.broadwaydental.ca/post6.htm , when you fill out the form. I have tried placing the proper permissions all over the place to try to get this working, but alas no results. The same error message comes up everytime. Has anyone seen this mess before? Help?!

Forbidden
You don't have permission to access /post.cgi on this server.

Thanks in advance.
Don
0
Question by:donlizard
    20 Comments
     
    LVL 6

    Expert Comment

    by:nihlcat
    You know, the error it spits out is a different website.  Can you shed any light on that?

    Forbidden
    You don't have permission to access /post.cgi on this server.


    --------------------------------------------------------------------------------

    Apache/1.3.27 Server at www.appraisers.com Port 80
    0
     
    LVL 6

    Expert Comment

    by:nihlcat
    Just cusious, did the permissions set to on the script, or the cgi-bin?
    0
     
    LVL 6

    Expert Comment

    by:nihlcat
    Um, ignore that last question, my mind is in Apache...
    0
     
    LVL 1

    Author Comment

    by:donlizard
    Hi,

    Yes I noticed that the errorr message  points to another site, which is curious. I have looked at the code and there is no mention of that other site in the code.... strange. Here is the code for the post.cgi, maybe I'm blacking out and missed something.

    Thanks,
    Don

    *copyrighted material removed by Netminder 17 Feb 2008*
    0
     
    LVL 6

    Expert Comment

    by:nihlcat
    Ok, what this tells me right off the bat is that you are invoking Perl from SOMEONE's UNIX based server:
    #!/usr/local/bin/perl

    Nothing special about that, but all of the $ variables in the above program are probably defined in a config file on the same UNIX server you are calling PERL from.  Probably in /var/www/html/cgi-bin.  If this is one of your servers, set the permissions on Post.cgi to RWX,RX,RX (755), and see how it goes.

    If you don't own any UNIX servers then I'm lost.  The mail app that executes post.cgi needs to be in your Scripts under Inetpub directory, and configured to run there.  This assumes you already have Perl installed and configured.

    Basically, what it looks like is that when you hit 'send', you are trying to get another server mail app to send mail for you.  
    0
     
    LVL 6

    Expert Comment

    by:nihlcat
    Something else just occured to me.  I am making the assumption that the above script has associated config files (in UNIX they almost always do).  It appears that one of these config files has an incorrect URL in it as well (www.appraisers.com).  I have installed one or two of these mail scripts in the past, can you check the config file that works with the script above for the correct paths to cgi-bin, and the correct URL?
    0
     
    LVL 6

    Expert Comment

    by:nihlcat
    Sorry for being such a prolific writer, but it helps me get my head around problems sometimes.  Here's what I understand:

    You are running windows 2003 with IIS6 and Active Perl (no UNIX servers).
    You have a Perl script and you want to run it on the 2003 server.

    From that I can tell you that the file Post.cgi just won't run, because the first line of the script
    (#!/usr/local/bin/perl) is the default location of Perl in UNIX, not Windows, so that needs to be fixed.
    I'm sure you've already been to this site, but here are important areas you need to review to get this running:

    http://aspn.activestate.com/ASPN/docs/ActivePerl/faq/Windows/ActivePerl-Winfaq6.html#How_do_I_configure_IIS_6
    http://aspn.activestate.com/ASPN/docs/ActivePerl/faq/Windows/ActivePerl-Winfaq4.html
    0
     
    LVL 1

    Author Comment

    by:donlizard
    Hi nihlcat,

    I noticed that line at the top also, but if the # is in front of the line doesn't that mean that that line is remarked out and not active? Oh by the way I didn't code this mess I'm trying too just get it going. Seems like a head scratcher. I also checked one other cgi file in the directory, and it doesn't seem to point to anywhere else either. This is going to drive me to drink, and it's a short drive!!

    Don
    0
     
    LVL 6

    Expert Comment

    by:nihlcat
    No, no, that's a UNIX character #!, called a 'shebang' and it's not a windows 'ignore this', in UNIX it means something totally different.  That first line of the script is meant to tell UNIX "this is not machine code, this is a script, run it from this UNIX directory."

    So you can see the problem we have to work with here.  Well, must you use this Perl script on you site?
    0
     
    LVL 1

    Author Comment

    by:donlizard
    It's the one that was uploaded, and they thought that the person who did the scripting had it working the whole time. Now this guy doesn't exist anymore, so it seems up to me to get it working. I love my job...I love my job...I love my job...I love my job.. yea that's it!
    0
     
    LVL 6

    Expert Comment

    by:nihlcat
    I very seriously doubt it was ever working configured that way.  Ok, well, what prevents you from building a form that executes the SMTP engine built into IIS6?
    0
     
    LVL 1

    Author Comment

    by:donlizard
    I completely agree that this may never have worked properly. I suppose that a person could write new scripting in either asp or php to get this working properly, but I think the original idea was to send an e-mail and being able to view the greeting card online somewhere. I think that seems like the idea.

    Don.
    0
     
    LVL 6

    Accepted Solution

    by:
    Ah, I see.  well, I don't mean to poo on your script, but even if it were running I'm think it's a nifty way to get steal e-mail.  Have a look, you can write anything you like in the to and from fields.  Anyway, moving forward, it's going to take some effort to get it running with ActivePerl.  It can still be done, but you'll need to follow those links and convince Windows via file association that a .pl or .cgi is an actual executeable.  Otherwise, (and my personal recommendation) you should try and build a form from the native mail prog in IIS.

    Sorry I wasn't able to help you more! :(
    0
     
    LVL 1

    Author Comment

    by:donlizard
    Thanks for all your help! I went to those links you suggested, and I already had the server setup properly to do that sort of scripting. I'm going to try a couple of other pathing things I have found to see if I can point it to the proper files and or server.

    Don
    0
     
    LVL 1

    Author Comment

    by:donlizard
    I'm getting closer I think! I noticed in the coding that everything was pointing to http://www.broadwaydental.com, the actual site is http://www.broadwaydental.ca!. The other server error message has disappeared! I think I just need to point the scripting to the proper directory on my Windows Server 2003 where the ]Perl is and it may go. But sso far antything I put in there hasn't worked yet. Hmmmmmm....

    Don
    0
     
    LVL 6

    Expert Comment

    by:nihlcat
    Ok yeah, what I'm seeing it this:
    *******************************
    The page cannot be displayed
    The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
    --------------------------------------------------------------------------------

    Please try the following:

    Contact the Web site administrator if you believe that this request should be allowed.
    Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
    HTTP Error 405 - The HTTP verb used to access this page is not allowed.
    Internet Information Services (IIS)
    ***********************************
    Would that have to do with Get or Post in the form?  Sure sounds like it...
    0
     
    LVL 7

    Expert Comment

    by:corneliup
    W2K3 comes fully "locked down", meaning that only the basic files and scripts are authorized by default. To allow Perl scripts to be served via the web, you'll need run the IIS 6 admin console, right-mouse click on Web Service Extensions, and select "Add a new web service extension". Enter a name like "Perl CGI Scripts" for the description and click "Add" to add the required Perl files. Then enter the following verbatim (including the double-quotes, which are very important)

      c:\Perl\bin\perl.exe "%s" %s

    This assumes that you have installed Perl in C:\Perl. If it's in another directory, change the path above. After this, click "Set extension status to Allowed" and then OK. You'll now see Perl CGI Scripts as an allowable CGI extension.

    0
     
    LVL 1

    Author Comment

    by:donlizard
    I have renamed the .cgi pages to .pl and have already enabled Perl/CGI scripts to run. Then repathed the scripts to reflect where the executables and etc are. The scripts are now starting to run except for one thing. The script uses "sendmail.exe" to send out the messages. Servers used to use that exe on older Windows NT 4.0 machines, but I think the world has moved on to different exe's to use. That executable seems to hang then time out before it actually sends anything out. I'm thinking that that exe cannnot run properly under Windows Server 2003. Any comments on this?

    Don
    0
     
    LVL 7

    Assisted Solution

    by:corneliup
    The "clean" and secure way to send mail from iis6 on win2k3 is to use .asp
    here is a good tutorial on how to do this:
    Send Email Using ASP on .Net Server or WinXP Pro
    http://www.sitepoint.com/article/asp-net-server-winxp-pro

    And here is a tutorial on how to do it with perl:
    Programming Perl 101
    3) Sending email with Perl

    http://www.sitepoint.com/article/programming-perl-101/7

    0
     
    LVL 1

    Author Comment

    by:donlizard
    Thanks for all the help.

    Don
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    Title # Comments Views Activity
    WSUS 0x80072ee2 Error 16 102
    Injecting Server2003 into 2012 AD 3 33
    Move authentication role 3 28
    Moving Files servers to DFS 11 9
    There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    884 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now