Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
PWS executes Perl CGIs just fine. I do a lot of development using PWS on both Win98 and NT, then upload to my ISP (which runs Apache on FreeBSD). It's a reasonable development environment.

The trick is to convince PWS that .cgi (or .pl) means Perl. This requires editing the registry. (The ActiveState installer is supposed to do this, but I've found it to be less than reliable.)

Here's what you need to do:

  1. Install PWS
  2. Install ActiveState Perl
  3. Use the Personal Web Manager control to stop PWS
  4. Edit the registry as described below
  5. Reboot the machine (optional on NT, required on 98)
  6. Use the Personal Web Manager control to start PWS

You should now be able to execute CGIs.

To edit the registry, do the following:

  1. Start regedit (Start / Run / regedit).
  3. Open SYSTEM
  4. Open CurrentControlSet
  5. Open Services
  6. Open W3SVC
  7. Open Parameters
  8. Open ScriptMap
  9. Edit / New / String Value
  10. Name the new string ".cgi"
  11. Double-click on ".cgi" to open an edit dialog
  12. Type c:\perl\bin\perl.exe %s %s
  13. Click OK
  14. Close regedit

The kicker is that if you get these steps wrong and set up the scriptmap with a bad .cgi string, you'll need to uninstall and reinstall PWS. (PWS extracts the scriptmap settings and caches them in its MetaBase, and if a bad string gets in there, you can be SOL with PWS, at least in Win98. The MetaBase doesn't have good editing tools.)

(Update: Oh yeah, you need to use the Personal Web Manager control set set "execute" permission on each directory that you want to run CGIs from.)

Here's test.cgi, a handy script to drop into C:\InetPub\scripts\ for testing. Once you can hit http://localhost/scripts/test.cgi, you're on the air.

#!/usr/bin/perl -w print "Content-type: text/html\n\n"; print "<html><body><pre>"; foreach $key ( sort keys %ENV ) { print $key, ": ", $ENV{$key}, "\n"; } print "</pre></body></html>\n";

In reply to Re: Perl & Personal Web Server by dws
in thread Perl & Personal Web Server by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (6)
    As of 2018-01-24 12:58 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (261 votes). Check out past polls.