Re: IIS Config Help - This is a hard one - Migration from Linux to Win2K

From: BB (Bernard_at_3exp.com)
Date: 02/10/03


From: "BB" <Bernard_at_3exp.com>
Date: Mon, 10 Feb 2003 10:34:38 +0800


Not sure, but see if this help or try linux group
HOW TO: Migrate Apache Settings and Configure IIS in a UNIX-to-Windows
Migration
http://support.microsoft.com/?id=324213

Rgds.

"Allen" <umayxa3@yahoo.com> wrote in message
news:dc2b29ad.0302080352.2771aed8@posting.google.com...
> I am migrating a website from a Linux server to a Win2k server.
> The website is using /cgi-bin and perl script to parse a URL. I'm not
> sure how to duplicate the parsing of the URL in IIS.
>
> THIS IS HOW IT IS CURRENTLY WORKING:
> There is a PHP page that generates a list of available links to binary
> documents (Word, Excel, PDF, etc). The URL for the link to the
> document contains the data for the DB query. The binary data is stored
> in the DB. When the URL is called, Apache is trigger by a keyword in
> the URL to pass the following URL data to the Perl script.
>
> Example: On the page would be a link to
> http://www.mysite.com/getpage/1289/quote.doc
> The text '/getpage' is a trigger to Apache that this needs to be sent
> to a CGI script. The two variables after the text '/getpage', /1289
> and /quote.doc, are passed to the CGI script to do a SQL query and
> pop-up the binary data in a new browser page.
>
> Below you will find the Vhosts.conf entry and the code for the CGI.
>
> I want to replicate this to work on the new Win2K server. Can someone
> help me configure IIS to do the "ScriptAliasMatch ^/getpage(.*)
> /var/www/cgi-bin/getpage.cgi$1" forwarding?
>
> Thanks for any help.
>
> -Allen
> umayxa3@yahoo.com
>
>
>
> THIS IS THE CODE FROM THE Vhosts.conf FILE
>
> ################# Named VirtualHosts
> NameVirtualHost <INSERT IP ADDRESS HERE>
> <VirtualHost <INSERT IP ADDRESS HERE>>
> ServerName www.mysite.com
> ServerPath /domain
> DocumentRoot /var/www/html/www.mysite.com
> AddHandler cgi-script .pl
> ScriptAliasMatch ^/getpage(.*) /var/www/cgi-bin/getpage.cgi$1
> </VirtualHost>
>
>
>
> THIS IS THE ACTUAL CGI SCRIPT, GETPRICE.CGI
>
> #!/usr/bin/perl -w
>
> ### this is a simple cgi that will pull a binary doc from a sql db
> and wrap it in the correct http he
> ader due browser issues with mime types
>
> use strict;
>
> ### db connect foo ###
> use DBI;
> use DBD::mysql;
>
> my $db_host = '<INSERT IP HERE';
> my $db_name = '<INSERT DB NAME HERE>';
> my $db_user = '<INSERT USER HERE>';
> my $db_pass = '<INSERT PASS HERE>';
>
> my $dbh = DBI->connect( "DBI:mysql:$db_name:$db_host", $db_user,
> $db_pass) or die DBI->errstr;
>
> ## get the doc id ##
> my $uri = $ENV{REQUEST_URI};
> my $doc_id = $uri;
> $doc_id =~ /getpage\/(.*)\//;
> $doc_id = $1;
>
> ## pull doc ##
> my $statement = "SELECT bin_data, filetype FROM binary_data WHERE
> id = '$doc_id' LIMIT 1";
> my $sth = $dbh->prepare($statement);
> my $result = $sth->execute();
>
> my $row = $sth->fetchrow_hashref();
>
> if($row->{filetype} =~ /pdf/i){
> print "Content-Type: pdf\r\n\r\n";
> } elsif ($row->{filetype} =~ /word/i){
>
> print "Content-Type: msword\r\n\r\n";
>
> } elsif ($row->{filetype} =~ /rtf/i){
>
> print "Content-Type: rtf\r\n\r\n";
>
> } elsif (($row->{filetype} =~ /xls/i) || ($row->{filetype} =~
> /excel/i)) {
>
> print "Content-Type: xls\r\n\r\n";
>
> } else {
> print "Content-Type: text/html\r\n\r\n";
> }
>
> ## push the binary doc ##
> print "$row->{bin_data}\n";
>
> ## done ##
>
> $dbh->disconnect or die DBI->errstr;
>
> ##__EOF__##



Relevant Pages