home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0"?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd">
- <html xmlns="http://www.w3.org/TR/xhtml1">
- <head>
- <title>perlwin32faq6 - web server info</title>
- <link rev="made" href="mailto:bjepson@debian.ids.net" />
- <meta name="GENERATOR" charset="iso-8859-1" />
- <link rel="STYLESHEET" href="../win32prk.css" type="text/css"
- media="screen" />
- </head>
-
- <body bgcolor="#ffffff">
- <!-- beginning of leaf header-->
-
- <table width="100%">
- <tr>
- <td bgcolor="000000" width="70" height="31"><a href=
- "http://www.activestate.com/"><img src="ASbutton.gif" alt=
- "ActiveState Home Page" border="0" width="68" height=
- "30" /></a></td>
-
- <td width="10" bgcolor="#ffffff"> </td>
-
- <td valign="middle" bgcolor="#cc0066"><font face=
- "sans-serif" size="+1" color="#ff99cc">
- Win32 FAQ</font></td>
- </tr>
- </table>
- <!-- end of leaf content--><!-- INDEX BEGIN -->
-
- <ul>
- <li><a href="#NAME">NAME</a></li>
-
- <li>
- <a href="#DESCRIPTION">DESCRIPTION</a>
-
- <ul>
- <li><a href="#What_HTTP_servers_support_Perl_f">What HTTP
- servers support Perl for Win32?</a></li>
-
- <li><a href="#How_do_I_use_Perl_for_Win32_unde">How do I
- use Perl for Win32 under Apache?</a></li>
-
- <li><a href="#How_do_I_configure_the_EMWAC_htt">How do I
- configure the EMWAC https server to support Perl for
- Win32?</a></li>
-
- <li><a href="#How_do_I_configure_IIS_3_0_or_lo">How do I
- configure IIS 3.0 or lower to support Perl</a></li>
-
- <li><a href="#How_do_I_configure_Microsoft_IIS">How do I
- configure Microsoft IIS 4.0 to support Perl</a></li>
-
- <li><a href="#How_do_I_configure_Netscape_web_">How do I
- configure Netscape web servers to support Perl for
- Win32?</a></li>
-
- <li><a href="#How_do_I_configure_WebSite_1_0_t">How do I
- configure WebSite 1.0 to support Perl for Win32?</a></li>
-
- <li><a href="#How_do_I_configure_WebSite_Profe">How do I
- configure WebSite Professional to support Perl for
- Win32?</a></li>
-
- <li><a href="#How_do_I_configure_Purveyor_to_s">How do I
- configure Purveyor to support Perl for Win32?</a></li>
-
- <li><a href="#How_do_I_configure_Microsoft_Per">How do I
- configure Microsoft Personal Web Server 1.0x for Windows
- 95 to</a></li>
-
- <li><a href="#How_do_I_configure_other_web_ser">How do I
- configure other web servers to support Perl for
- Win32?</a></li>
-
- <li><a href="#My_program_runs_fine_from_the_co">My
- program runs fine from the command line, but bombs out
- when</a></li>
-
- <li><a href="#This_is_all_such_a_hassle_why_c">This is
- all such a hassle; why can't I just put perl.exe in my
- CGI</a></li>
- </ul>
- </li>
-
- <li><a href="#AUTHOR_AND_COPYRIGHT">AUTHOR AND
- COPYRIGHT</a></li>
- </ul>
- <!-- INDEX END -->
- <hr />
- <br />
-
- <h1><a name="NAME">NAME</a></h1>
-
- <p>perlwin32faq6 - web server info</p>
- <br />
- <hr />
-
- <h1><a name="DESCRIPTION">DESCRIPTION</a></h1>
-
- <p>Perl for Win32 Web Server Configuration and
- Troubleshooting</p>
- <br />
- <hr />
-
- <h2><a name="What_HTTP_servers_support_Perl_f">What HTTP
- servers support Perl for Win32?</a></h2>
-
- <p>Most Windows <font size="-1">NT</font> and Windows 95
- servers that use the <font size="-1">CGI</font> standard or
- <font size="-1">ISAPI</font> will run Perl for Win32 scripts.
- The following servers are known to work with Perl for Win32
- (known protocols in brackets):</p>
-
- <dl>
- <dt><strong><a name="item_Alibaba">Alibaba from Computer
- Software Manufaktur [CGI, ISAPI]</a></strong></dt>
-
- <dd>
- <br />
- <pre>
- <a href=
- "http://alibaba.austria.eu.net/">http://alibaba.austria.eu.net/</a>
- </pre>
- </dd>
-
- <dt><strong><a name="item_Apache">Apache for Win32 [CGI,
- mod_perl]</a></strong></dt>
-
- <dd>
- <p>NOTE: mod_perl currently only works when Perl is built
- <em>without</em> PERL_OBJECT support on win32. Since
- ActivePerl is built under the PERL_OBJECT regime, mod_perl
- users will need to build Perl from the sources.</p>
- <br />
- <pre>
- <a href="http://www.apache.org">http://www.apache.org</a>
- mod_perl home page: <a href=
- "http://perl.apache.org">http://perl.apache.org</a>
- </pre>
- </dd>
-
- <dt><strong><a name="item_EMWAC">EMWAC Web Server
- [CGI]</a></strong></dt>
-
- <dd>
- <br />
- <pre>
- <a href=
- "http://emwac.ed.ac.uk/html/internet_toolchest/https/contents.htm">http://emwac.ed.ac.uk/html/internet_toolchest/https/contents.htm</a>
- </pre>
- </dd>
-
- <dt><strong><a name="item_Microsoft">Microsoft Internet
- Information Server [CGI, ISAPI]</a></strong></dt>
-
- <dd>
- <br />
- <pre>
- <a href=
- "http://www.microsoft.com/iis/">http://www.microsoft.com/iis/</a>
- </pre>
- </dd>
-
- <dt><strong><a name="item_Netscape">Netscape Enterprise and
- FastTrack Server [CGI, nsapi_perl]</a></strong></dt>
-
- <dd>
- <br />
- <pre>
- <a href=
- "http://home.netscape.com/">http://home.netscape.com/</a>
- mod_nsapi home page: <a href=
- "http://interact.canoe.ca/~bsugars/nsapi_perl.html">http://interact.canoe.ca/~bsugars/nsapi_perl.html</a>
- </pre>
- </dd>
-
- <dt><strong><a name="item_O">O'Reilly WebSite Professional
- [CGI, ISAPI, WSAPI]</a></strong></dt>
-
- <dd>
- <br />
- <pre>
- <a href="http://software.ora.com/">http://software.ora.com/</a>
- </pre>
- </dd>
-
- <dt><strong><a name="item_Purveyor">Purveyor by Process
- Software [CGI, ISAPI]</a></strong></dt>
-
- <dd>
- <br />
- <pre>
- <a href="http://www.process.com/">http://www.process.com/</a>
- </pre>
- </dd>
- </dl>
-
- <p>There's a list of web servers for Windows, Windows 95, and
- Windows <font size="-1">NT</font> on this Yahoo Page:</p>
- <br />
- <pre>
- <a href=
- "http://www.yahoo.com/Computers_and_Internet/Software/Internet/World_Wide_Web/Servers/Microsoft_Windows_Windows_95/">http://www.yahoo.com/Computers_and_Internet/Software/Internet/World_Wide_Web/Servers/Microsoft_Windows_Windows_95/</a>
- </pre>
-
- <p>(That's all one <font size="-1">URL.)</font></p>
- <br />
- <hr />
-
- <h2><a name="How_do_I_use_Perl_for_Win32_unde">How do I use
- Perl for Win32 under Apache?</a></h2>
-
- <p>NOTE: mod_perl currently only works when Perl is built <em>
- without</em> PERL_OBJECT support on win32. Since ActivePerl is
- built under the PERL_OBJECT regime, mod_perl users will need to
- build Perl from the sources.</p>
-
- <p>If you want to put all of your <font size="-1">CGI</font>
- scripts into one directory, add the following line to your <em>
- srm.conf</em> file (You can choose any directory you'd like,
- but make sure it exists):</p>
- <br />
- <pre>
- ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"
- </pre>
-
- <p>After you have made this change, stop and restart the Apache
- service.</p>
-
- <p>Apache provides an emulation of the <font size="-1">
- UNIX</font> shebang (#!/path/to/perl) syntax, so the next step
- is easy. You can put you Perl scripts into your <em>
- cgi-bin</em> directory, as long as you have a path to a valid
- interpreter at the top. For example:</p>
- <br />
- <pre>
- #!C:\PERL\5.00464\bin\MSWin32-x86\perl.exe
-
- use CGI qw(:standard) ;
- print header();
- print "Hello, world";
- </pre>
-
- <p>If you want to enable <font size="-1">CGI</font> scripts
- based on an extension, such as <em>.pl</em>, you need to add
- the following line to <em>srm.conf</em>:</p>
- <br />
- <pre>
- AddHandler cgi-script .pl
- </pre>
-
- <p>By default, <font size="-1">CGI</font> scripts are not
- allowed in your DocumentRoot directory, but they are allowed in
- other document directories. Document directories are created
- with the Alias command in <em>srm.conf</em>:</p>
- <br />
- <pre>
- Alias /ResourceKit/ "E:/utilsamp/"
- </pre>
-
- <p>You can then include files that end in <em>.pl</em> within a
- document directory. You will still need to include the #! line
- with the full path to the <em>perl.exe</em> interpreter, as
- shown earlier.</p>
-
- <p>If you want to allow <font size="-1">CGI</font> scripts in
- the DocumentRoot directory, add the ExecCGI option to the
- Options directive between the <Directory> and
- </Directory> entry for your DocumentRoot in <em>
- access.conf</em> (these appear directly after the comment
- titled:</p>
- <br />
- <pre>
- # This should be changed to whatever you set DocumentRoot to.
-
- After you have updated it, your Options directive may look something like:
- </pre>
- <br />
- <pre>
- Options Indexes FollowSymLinks ExecCGI
- </pre>
- <br />
- <hr />
-
- <h2><a name="How_do_I_configure_the_EMWAC_htt">How do I
- configure the EMWAC https server to support Perl for
- Win32?</a></h2>
-
- <p>First, read the <font size="-1">EMWAC</font>
- documentation:</p>
- <br />
- <pre>
- <a href=
- "http://emwac.ed.ac.uk/html/internet_toolchest/https/scripts.htm">http://emwac.ed.ac.uk/html/internet_toolchest/https/scripts.htm</a>
- </pre>
-
- <p>You need to follow these steps:</p>
-
- <ol>
- <li>
- <strong><a name="item_"></a></strong>
-
- <p>Install Perl for Win32.</p>
- </li>
-
- <li>
-
-
- <p>Install the <font size="-1">EMWAC</font> server. Ensure
- that <font size="-1">EMWAC</font> can serve <font size=
- "-1">HTML</font> files correctly.</p>
- </li>
-
- <li>
-
-
- <p>Make sure that the bin subdirectory of your Perl
- directory is in the system <code>PATH</code> variable. This
- should be the subdirectory where perl.exe is located, such
- as <em>C:\Perl\5.00500\bin\MSWin32-x86</em>. Note that this
- must be set in the Control Panel, not on the command line,
- and it must be a system environment variable, not a user
- environment variable.</p>
- </li>
-
- <li>
-
-
- <p>Make sure that your script has the extension <code>
- .pl</code>. This is the only way that the https service
- recognizes the file as a Perl script.</p>
- </li>
-
- <li>
-
-
- <p>Ensure that the script is readable by the account used
- by the <font size="-1">EMWAC</font> server. Generally, this
- means you should make the script readable by the Everyone
- group.</p>
- </li>
-
- <li>
-
-
- <p>Ensure that all supporting files, like the perl binary
- files, the perl library files, and the modules that you
- use, are all readable by the account used by the <font
- size="-1">EMWAC</font> server (i.e., the Everyone
- group).</p>
- </li>
- </ol>
-
- <p>When the <font size="-1">EMWAC</font> server gets an <font
- size="-1">HTTP</font> request for a file with a <em>.pl</em>
- extension, it tries to execute <code>perl [filename]</code>.
- This is the only way you can get Perl scripts to work on the
- <font size="-1">EMWAC</font> server, so you need to follow the
- above directions.</p>
-
- <p>By default, the Perl for Win32 installation puts the path to
- <em>perl.exe</em> in <code>@INC</code>.</p>
-
- <p>Because the <font size="-1">EMWAC</font> server runs as a
- service (see <a href=
- "perlwin32faq4.html#What_is_a_Windows_NT_service_">What is a
- Windows NT service?</a>), you need to take special steps to
- make files and environment variables like <code>PATH</code>
- accessible. Just because you can read a script and run it from
- the command line doesn't mean that the server can.</p>
- <br />
- <hr />
-
- <h2><a name="How_do_I_configure_IIS_3_0_or_lo">How do I
- configure IIS 3.0 or lower to support Perl for Win32?</a></h2>
-
- <p>By default, the Perl for Win32 installation maps the <em>
- .plx</em> extension to Perl for <font size="-1">ISAPI.</font>
- You can override the extension used during installation.
- Because the installation does this only when <font size="-1">
- IIS</font> is already installed, you must install <font size=
- "-1">IIS</font> first, then install Perl for Win32. If you need
- to reconfigure these settings, or if you must set these by
- hand, the instructions in this section will prove useful.</p>
-
- <p>Microsoft Internet Information Server <font size="-1">
- (IIS)</font> ships with Windows <font size="-1">NT</font>
- Server. Peer Web Services <font size="-1">(PWS)</font> ships
- with Windows <font size="-1">NT</font> Workstation. Configuring
- the products is essentially the same. First, you should consult
- Chapter 8, Publishing Information and Applications, in the
- <font size="-1">IIS</font> documentation.</p>
-
- <p>You need to follow these steps to get Perl for Win32 scripts
- to run under <font size="-1">IIS:</font></p>
-
- <ol>
- <li>
-
-
- <p>Associate the extension for your scripts with the
- appropriate interpreter in the script map for <font size=
- "-1">IIS.</font> This is under the Registry key <font size=
- "-1">HKEY_LOCAL_SYSTEM,</font> with the sub-key
- ``System\CurrentControlSet\Services\W3SVC\Parameters\Script
- Map''. Many people map two extensions: one to <em>
- perl.exe</em> (for example, <em>.pl</em>) and another to
- <em>PerlIS.dll</em> (for example, <em>.plx</em>). Note that
- mapping an extension in the script map is <em>not</em> the
- same as associating the extension in Explorer. Use the full
- paths to the executable files in the script map.</p>
- </li>
-
- <li>
-
-
- <p>Put your scripts in a virtual directory on the server
- that has Execute access but not Read access. You can add
- virtual directories or view their access with the Internet
- Service Manager. Remember that the URLs for your virtual
- directories can't overlap with URLs to directories in the
- <font size="-1">WWW</font> root directory. For example, You
- can't have a <em>cgi-bin</em> virtual directory and a real
- <em>cgi-bin</em> subdirectory of the <font size="-1">
- WWW</font> root.</p>
- </li>
-
- <li>
-
-
- <p>Ensure that your scripts are readable by the account
- used by the <font size="-1">IIS</font> server. You set this
- account in Internet Service Manager; it is set to
- IUSR_[your server name] by default. See also <a href=
- "perlwin32faq4.html#What_is_a_Windows_NT_service_">What is
- a Windows NT service?</a> and <a href=
- "perlwin32faq4.html#How_do_I_set_permissions_on_a_fi">How
- do I set permissions on a file?</a>.</p>
- </li>
-
- <li>
-
-
- <p>Ensure that all supporting files, like the perl binary
- files, the perl library files, and the modules that you
- use, are all readable by the account used by the <font
- size="-1">IIS</font> server. See also <a href=
- "perlwin32faq4.html#What_is_a_Windows_NT_service_">What is
- a Windows NT service?</a> and <a href=
- "perlwin32faq4.html#How_do_I_set_permissions_on_a_fi">How
- do I set permissions on a file?</a>.</p>
- </li>
- </ol>
-
- <p>You need to restart the web service after making the
- Registry changes or installing Perl.</p>
-
- <p>Because <font size="-1">IIS</font> runs as a service (see <a
- href="perlwin32faq4.html#What_is_a_Windows_NT_service_">What is
- a Windows NT service?</a>), you need to take special steps to
- make sure that files and environment variables are available to
- it.</p>
- <br />
- <hr />
-
- <h2><a name="How_do_I_configure_Microsoft_IIS">How do I
- configure Microsoft IIS 4.0 to support Perl for Win32?</a></h2>
-
- <p>Microsoft <font size="-1">IIS</font> 4.0 ships with Windows
- <font size="-1">NT</font> Server 5.0, and <font size="-1">
- PWS</font> 4.0 ships with Windows <font size="-1">NT</font>
- Workstation 5.0. Both <font size="-1">IIS</font> and <font
- size="-1">PWS</font> are available as part of the Microsoft
- Windows <font size="-1">NT</font> 4.0 Option Pack. You can find
- a link to the Option Pack at <a href=
- "http://www.microsoft.com/iis/">
- http://www.microsoft.com/iis/</a></p>
-
- <p>To configure <font size="-1">IIS</font> or <font size="-1">
- PWS</font> 4.0 to run Perl scripts:</p>
-
- <ol>
- <li>
-
-
- <p>Open the <font size="-1">IIS</font> 4.0 Internet Service
- Manager. This will bring up the Microsoft Management
- Console with the Internet Service Manager snap-in
- selected.</p>
- </li>
-
- <li>
-
-
- <p>From the tree display on the left, select the level at
- which to apply the mappings. You can choose an entire
- server, web site, or a given virtual directory.</p>
- </li>
-
- <li>
-
-
- <p>Select Properties from the Action menu.</p>
- </li>
-
- <li>
-
-
- <p>If you chose to administer the properties for the entire
- server, the Server Properties dialog will appear. Select
- <font size="-1">WWW</font> Service from the Master
- Properties pull-down menu and click the Edit button under
- Master Properties. This opens <font size="-1">WWW</font>
- Service Master Properties. Select the Home Directory tab
- and proceed to step 7.</p>
- </li>
-
- <li>
-
-
- <p>If you chose to administer the properties for an entire
- web site, the Web Site Properties sheet appears. Select the
- Home Directory tab and proceed to step 7.</p>
- </li>
-
- <li>
-
-
- <p>If you chose to administer the properties for a virtual
- directory, the Virtual Directory Properties sheet appears.
- Select the Virtual Directory tab and proceed to step 7.</p>
- </li>
-
- <li>
-
-
- <p>Click the Configuration button. This opens the
- Application Configuration dialog.</p>
- </li>
-
- <li>
-
-
- <p>Select the App Mappings tab and click the Add button.
- You see the Add/Edit Application Extension Mapping
- dialog.</p>
- </li>
-
- <li>
-
-
- <p>To run Perl as a <font size="-1">CGI</font> application,
- type the full path to <em>Perl.EXE</em> followed by <code>
- %s %s</code>. When a script is executed, the first <code>
- %s</code> will be replaced by the full path to the script,
- and the second <code>%s</code> will be replaced by the
- script parameters.</p>
- </li>
-
- <li>
-
-
- <p>To run Perl for <font size="-1">ISAPI,</font> type the
- full path to <em>PerlIS.DLL</em>. The <code>%s %s</code> is
- not required for <font size="-1">ISAPI</font> DLLs.</p>
- </li>
-
- <li>
-
-
- <p>In the Extension field, type <em>.pl</em> or <em>
- .plx</em> (or whatever extension you want to use).</p>
- </li>
-
- <li>
-
-
- <p>The application mapping is now complete. Click the <font
- size="-1">OK</font> button and click <font size="-1">
- OK</font> to dismiss any remaining dialogs/property
- sheets.</p>
- </li>
-
- <li>
-
-
- <p>Close the <font size="-1">IIS</font> 4.0 Internet
- Service Manager.</p>
- </li>
- </ol>
-
- <p>Because <font size="-1">IIS</font> runs as a service (see <a
- href="perlwin32faq4.html#What_is_a_Windows_NT_service_">What is
- a Windows NT service?</a>), you need to take special steps to
- make sure that files and environment variables are available to
- it.</p>
- <br />
- <hr />
-
- <h2><a name="How_do_I_configure_Netscape_web_">How do I
- configure Netscape web servers to support Perl for
- Win32?</a></h2>
-
- <p>If you're using Netscape 1.x servers, you must wrap your
- Perl scripts in batch files. Refer to these Netscape tech
- notes:</p>
- <br />
- <pre>
- <a href=
- "http://help.netscape.com/kb/server/960513-3.html">http://help.netscape.com/kb/server/960513-3.html</a>
- <a href=
- "http://help.netscape.com/kb/server/960513-125.html">http://help.netscape.com/kb/server/960513-125.html</a>
- </pre>
-
- <p>The following information is for Netscape FastTrack Server
- 2.0. Other 2.0 and 3.0 Netscape Servers (Communications,
- Enterprise) should be similar.</p>
-
- <p>To set up Perl for Win32 to run on FastTrack Server, follow
- these steps:</p>
-
- <ol>
- <li>
-
-
- <p>Install FastTrack Server, and make sure you can retrieve
- <font size="-1">HTML</font> pages.</p>
- </li>
-
- <li>
-
-
- <p>Associate Perl scripts with the perl interpreter, if you
- haven't already. See <a href=
- "perlwin32faq4.html#How_do_I_associate_Perl_scripts_">How
- do I associate Perl scripts with perl?</a> for how to do
- this. You may need to re-start the server after making the
- association.</p>
- </li>
-
- <li>
-
-
- <p>Set up a Shell <font size="-1">CGI</font> directory to
- run Perl scripts. <font size="-1">A</font> regular <font
- size="-1">CGI</font> directory will not work -- that is
- only for executable files. You set this up with the
- FastTrack Administrator; see the documentation for
- details.</p>
- </li>
- </ol>
-
- <p>If you would like to access Perl <font size="-1">CGI</font>
- scripts in other directories, you need to associate an
- extension, such as <em>.pl</em>, with the shellcgi <font size=
- "-1">MIME</font> type. Before you follow these steps, you must
- add at least one Shell <font size="-1">CGI</font> directory -
- this will enable shellcgi on your server (you can delete this
- directory, and shellcgi will remain enabled). Follow these
- steps to associate <em>.pl</em> with the shellcgi <font size=
- "-1">MIME</font> type:</p>
-
- <ol>
- <li>
-
-
- <p>In the Server Administrator, click Server Preferences,
- then select <font size="-1">MIME</font> Types from the
- frame on the left.</p>
- </li>
-
- <li>
-
-
- <p>If you want to use <em>.pl</em> as the extension for
- Perl scripts, find and remove the application/x-perl <font
- size="-1">MIME</font> type (this is mapped to <em>.pl</em>
- by default).</p>
- </li>
-
- <li>
-
-
- <p>Add a new <font size="-1">MIME</font> Type with
- magnus-internal/shellcgi as the Content Type, and pl as the
- File Suffix. If a type for magnus-internal/shellcgi already
- exists, simply add pl to the list of File Suffixes. Don't
- include the leading dot on the file suffix.</p>
- </li>
-
- <li>
-
-
- <p>Save and apply these changes. You should be able to put
- a Perl <font size="-1">CGI</font> script in any directory,
- provided the script ends with the <em>.pl</em> suffix.</p>
- </li>
- </ol>
-
- <p>If you are having trouble running Perl scripts on your
- Netscape server, check the following:</p>
-
- <ul>
- <li>
- <p>Ensure that the script is readable by the account used
- by the Netscape service. Generally, this means you should
- make the script readable by the Everyone group.</p>
- </li>
-
- <li>
- <p>Ensure that all supporting files, like the perl binary
- files, the perl library files, and the modules that you
- use, are all readable by the account used by the Netscape
- service (i.e., the Everyone group).</p>
- </li>
- </ul>
-
- <p>One nice thing about FastTrack server is that the Error Log
- will give detailed reasons why your <font size="-1">CGI</font>
- script isn't running, so this is a good thing to check first
- when you are having configuration problems.</p>
-
- <p>Because Netscape servers run as services (see <a href=
- "perlwin32faq4.html#What_is_a_Windows_NT_service_">What is a
- Windows NT service?</a>), you need to take special steps to
- make sure that files and environment variables are available to
- them.</p>
-
- <p>Some people have reported problems with handling POST'ed
- data with Perl programs with Netscape servers. Since Netscape
- apparently uses associations to run scripts, and POST'ed data
- is sent on <font size="-1">STDIN</font> to a program. This may
- be related to the problems with redirection.</p>
- <br />
- <hr />
-
- <h2><a name="How_do_I_configure_WebSite_1_0_t">How do I
- configure WebSite 1.0 to support Perl for Win32?</a></h2>
-
- <p>The following information is for setting up O'Reilly WebSite
- to use Perl for Win32 for standard <font size="-1">CGI</font>
- (not PerlIS).</p>
-
- <ol>
- <li>
-
-
- <p>Install WebSite. Make sure you can retrieve <font size=
- "-1">HTML</font> pages before continuing.</p>
- </li>
-
- <li>
-
-
- <p>Associate Perl scripts with the perl interpreter, if you
- haven't already. See <a href=
- "perlwin32faq4.html#How_do_I_associate_Perl_scripts_">How
- do I associate Perl scripts with perl?</a> for how to do
- this. You may need to re-start the server after making the
- association.</p>
- </li>
-
- <li>
-
-
- <p>Set up a Standard <font size="-1">CGI</font> directory
- to hold your Perl scripts. You can use the Server
- Properties dialog box do to this.</p>
- </li>
-
- <li>
-
-
- <p>Ensure that the script is readable by the account used
- by the WebSite service. Generally, this means you should
- make the script readable by the Everyone group.</p>
- </li>
-
- <li>
-
-
- <p>Ensure that all supporting files, like the perl binary
- files, the perl library files, and the modules that you
- use, are all readable by the account used by the WebSite
- service (i.e., the Everyone group).</p>
- </li>
- </ol>
-
- <p>Because WebSite servers run as services (see <a href=
- "perlwin32faq4.html#What_is_a_Windows_NT_service_">What is a
- Windows NT service?</a>), you need to take special steps to
- make sure that files and environment variables are available to
- them.</p>
- <br />
- <hr />
-
- <h2><a name="How_do_I_configure_WebSite_Profe">How do I
- configure WebSite Professional to support Perl for
- Win32?</a></h2>
-
- <p>The following information is for setting up O'Reilly WebSite
- Professional to use Perl for Win32 for standard <font size=
- "-1">CGI</font> (not PerlIS).</p>
-
- <ol>
- <li>
-
-
- <p>Install WebSite Professional. Make sure you can retrieve
- <font size="-1">HTML</font> pages before continuing.</p>
- </li>
-
- <li>
-
-
- <p>Open Server Properties and click the Mapping tab. Server
- Properties is in the WebSite Professional folder on the
- Start menu.</p>
- </li>
-
- <li>
-
-
- <p>From the List Selector on the Mapping tab, choose
- Content Types.</p>
- </li>
-
- <li>
-
-
- <p>If there is an existing mapping for the extension you
- want to use (such as <em>.pl</em>), highlight the mapping
- and click Delete. Click Apply to immediately apply the
- change.</p>
- </li>
-
- <li>
-
-
- <p>Choose a file extension for Perl, such as <em>.pl</em>,
- and type it into the File Extension field. Make sure you
- include the leading period/full stop (.) in the file
- extension.</p>
- </li>
-
- <li>
-
-
- <p>Type wwwserver/shellcgi in the Media or Server-Side
- Content Type field.</p>
- </li>
-
- <li>
-
-
- <p>Click Add. Click Apply to immediately apply the
- change.</p>
- </li>
-
- <li>
-
-
- <p>Change the List Selector to Associations.</p>
- </li>
-
- <li>
-
-
- <p>If there is an existing mapping for the extension you
- want to use (such as <em>.pl</em>), highlight the mapping
- and click Delete. Click Apply to immediately apply the
- change.</p>
- </li>
-
- <li>
-
-
- <p>Type the file extension you chose in step 5 in the File
- Extension field. Make sure you include the leading
- period/full stop (.) in the file extension.</p>
- </li>
-
- <li>
-
-
- <p>Type the full path to Perl.exe, such as <em>
- C:\Perl\5.00500\bin\MSWin32-x86\Perl.exe</em>, in the
- Associated <font size="-1">EXE</font> or <font size="-1">
- DLL</font> field.</p>
- </li>
-
- <li>
-
-
- <p>Click Add. Click Apply to immediately apply the
- change.</p>
- </li>
-
- <li>
-
-
- <p>Close Server Properties. Reply appropriately to
- ``Terminate active connections and update the server
- settings?''. The server is now configured to execute Perl
- <font size="-1">CGI</font> scripts in directories marked as
- cgi-bin as well as document directories.</p>
- </li>
- </ol>
-
- <p>If you have trouble running scripts, ensure that the script
- is readable by the account used by the WebSite service.
- Generally, this means you should make the script readable by
- the Everyone group. Also, ensure that all supporting files,
- like the perl binary files, the perl library files, and the
- modules that you use, are all readable by the account used by
- the WebSite service (i.e., the Everyone group).</p>
-
- <p>Because WebSite servers run as services (see <a href=
- "perlwin32faq4.html#What_is_a_Windows_NT_service_">What is a
- Windows NT service?</a>), you need to take special steps to
- make sure that files and environment variables are available to
- them.</p>
- <br />
- <hr />
-
- <h2><a name="How_do_I_configure_Purveyor_to_s">How do I
- configure Purveyor to support Perl for Win32?</a></h2>
-
- <p>The following instructions are for Purveyor 1.2 for Windows
- <font size="-1">NT.</font> Other Purveyor products should be
- similar.</p>
-
- <ol>
- <li>
-
-
- <p>In the Purveyor Control Panel, use the <font size="-1">
- CGI</font> Mapping tab to map the <em>.pl</em> extension to
- <em>perl.exe</em>. Make sure that you use the full path to
- the executable.</p>
- </li>
-
- <li>
-
-
- <p>Also in the Purveyor Control Panel, use the Virtual
- Servers section to set your <font size="-1">CGI</font>
- Scripts directory. You need one scripts directory for each
- virtual server you support. The scripts directory must be
- in the data path for the server. Also, make sure that the
- Disable <font size="-1">CGI</font> Extension checkbox is
- unchecked.</p>
- </li>
-
- <li>
-
-
- <p>Ensure that the script is readable by the account used
- by the Purveyor service. Generally, this means you should
- make the script readable by the Everyone group.</p>
- </li>
-
- <li>
-
-
- <p>Ensure that all supporting files, like the perl binary
- files, the perl library files, and the modules that you
- use, are all readable by the account used by the Purveyor
- service (i.e., the Everyone group).</p>
- </li>
- </ol>
-
- <p>If you have problems while configuring Purveyor to use Perl
- for Win32, you can use the Enable Tracing checkbox in the
- Logging tab of the Purveyor Control Panel applet to trace <font
- size="-1">HTTP</font> requests and responses.</p>
-
- <p>Because Purveyor runs as a service (see <a href=
- "perlwin32faq4.html#What_is_a_Windows_NT_service_">What is a
- Windows NT service?</a>), you need to take special steps to
- make sure that files and environment variables are available to
- it.</p>
- <br />
- <hr />
-
- <h2><a name="How_do_I_configure_Microsoft_Per">How do I
- configure Microsoft Personal Web Server 1.0x for Windows 95 to
- support Perl for Win32?</a></h2>
-
- <p>Microsoft Personal Web Server for Windows 95 is a
- scaled-down version of Microsoft Internet Information Server.
- Although it is not documented, it appears that the method used
- to support Perl for Win32 with <font size="-1">IIS</font> will
- also work with Personal Web Server. See <a href=
- "#How_do_I_configure_IIS_3_0_or_lo">How do I configure IIS 3.0
- or lower to support Perl for Win32?</a>.</p>
- <br />
- <hr />
-
- <h2><a name="How_do_I_configure_other_web_ser">How do I
- configure other web servers to support Perl for Win32?</a></h2>
-
- <p>If your web server isn't listed, check the server's
- documentation on how to set up a <font size="-1">CGI</font>
- interpreter. In general the process is as follows:</p>
-
- <ul>
- <li>
- <p>Associate a file extension like <em>.pl</em> with the
- perl binary, and let the server know where the binary is.
- This may be a shell association, (see <a href=
- "perlwin32faq4.html#How_do_I_associate_Perl_scripts_">How
- do I associate Perl scripts with perl?</a>), or a custom
- association.</p>
- </li>
-
- <li>
- <p>Set up a directory where executable scripts go, and put
- your Perl script there.</p>
- </li>
-
- <li>
- <p>Ensure that the user account that the web server uses
- can read the script as well as any ancillary files (perl
- binary files, library files, modules, etc.). This usually
- means making the files available to the Everyone group.</p>
- </li>
- </ul>
-
- <p>Because most web servers run as services (see <a href=
- "perlwin32faq6.html#How_do_I_configure_IIS_3_0_or_lo">How do I
- configure IIS 3.0 or lower to support Perl for Win32?</a>), you
- need to take special steps to make sure that files and
- environment variables are available to them.</p>
- <br />
- <hr />
-
- <h2><a name="My_program_runs_fine_from_the_co">My program runs
- fine from the command line, but bombs out when run as a CGI
- script.</a></h2>
-
- <p>Usually, this means one of two things: either you have
- misconfigured your system, or your script does not output the
- right stuff to be a <font size="-1">CGI</font> script.</p>
-
- <p>Before you do anything else, check this list:</p>
-
- <ul>
- <li>
- <p>Make sure you have correctly configured your server for
- <em>perl.exe</em> or <em>perlis.dll</em>. This is often
- accomplished by mapping a specific extension, such as <em>
- .pl</em> or <em>.plx</em>, to <em>perl.exe</em> or <em>
- perlis.dll</em>. Usually, web servers rely on their own
- mappings, rather than the Windows command-line
- mappings.</p>
- </li>
-
- <li>
- <p>If your web server depends on the <code>PATH</code>
- variable to find <em>perl.exe</em>, make sure that you put
- <em>perl.exe</em> in your system <code>PATH</code>, not
- just your user <code>PATH</code>. This only applies to
- Windows <font size="-1">NT.</font></p>
- </li>
-
- <li>
- <p>If your web server requires directories to be marked as
- executable, make sure the directory that contains the
- script is marked as such.</p>
- </li>
-
- <li>
- <p>Since the web server can be configured to run as a local
- user, be sure that the user has access to the script file
- and the Perl binaries and libraries. Many web servers run
- as the ``Local System'' account, which generally has
- sufficient permissions.</p>
- </li>
-
- <li>
- <p>If <em>Perl.exe</em> or Perl for <font size="-1">
- ISAPI</font> fail to work as expected check your event logs
- for clues.</p>
- </li>
- </ul>
-
- <p>Check the information above with a script that you know
- produces the right output for the <font size="-1">CGI</font>
- protocol (scripts in this <font size="-1">FAQ</font> are a good
- first choice). Try it with your own script after you're sure
- the test script will work.</p>
-
- <p>If you are sure the server is running the script, but it
- only generates error messages in your browser, there are some
- tools that may help you out. CGI::Carp is used to send
- debugging information to the browser or log file. Even if your
- script has a compilation error, it can usually intercept and
- report errors. To use CGI::Carp, include the following lines in
- your program:</p>
- <br />
- <pre>
- # The stuff in the BEGIN block will be executed very early
- # on, even before the rest of this script is parsed.
- #
- BEGIN {
-
- # Use the CGI::Carp module and import the carpout() function.
- #
- use CGI::Carp qw(carpout);
-
- # Send warnings and die messages to the browser.
- #
- carpout(STDOUT);
-
- }
- </pre>
-
- <p>If your script has an error, you may see something like this
- in the browser:</p>
- <br />
- <pre>
- [Wed Jun 3 09:32:28 1998] C:\inetpub\scripts\test.pl: Error message! at
- C:\inetpub\scripts\test.pl line 38.
- </pre>
-
- <p>Sometimes, it can be helpful to put yourself in somebody
- else's position. The libwww-perl bundle <font size="-1">
- (LWP)</font> is available from <font size="-1">CPAN,</font> but
- you can install it using the Perl Package Manager <font size=
- "-1">(PPM).</font> <font size="-1">LWP</font> may be included
- with future releases of Perl for Win32.</p>
-
- <p> <font size="-1">LWP</font> includes the powerful <em>
- lwp-request</em> script, which lets you see things from the
- browser's perspective. Invoke <em>lwp-request</em> with the
- name of a <font size="-1">URL</font> to see the content of the
- response, as in <code>lwp-request http://localhost</code>. To
- inspect the headers of an <font size="-1">HTTP</font> response,
- invoke <em>lwp-request</em> with the <code>-de</code>
- switch:</p>
- <br />
- <pre>
- C:\>lwp-request -de <a href=
- "http://localhost">http://localhost</a>
- Date: Wed, 03 Jun 1998 13:37:31 GMT
- Accept-Ranges: bytes
- Server: Microsoft-IIS/4.0
- Content-Length: 4325
- Content-Location: <a href=
- "http://localhost/Default.htm">http://localhost/Default.htm</a>
- Content-Type: text/html
- ETag: "0c1e58b063bd1:1237"
- Last-Modified: Thu, 09 Apr 1998 12:09:28 GMT
- Client-Date: Wed, 03 Jun 1998 13:37:31 GMT
- Client-Peer: 127.0.0.1:0
- </pre>
-
- <p>This tool can be very helpful in figuring out exactly what
- your scripts are doing. Whatever you do, don't give up hope. It
- is, in fact, possible to get a Perl script running on your web
- server. Really.</p>
- <br />
- <hr />
-
- <h2><a name="This_is_all_such_a_hassle_why_c">This is all such
- a hassle; why can't I just put perl.exe in my CGI directory and
- use it in my URL?</a></h2>
-
- <p>First, the warning: <font size="-1">DON'T</font> <font size=
- "-1">DO</font> <font size="-1">THIS.</font> <font size="-1">
- REALLY.</font> <font size="-1">EVEN</font> <font size="-1">
- IF</font> <font size="-1">YOU</font> <font size="-1">
- DON'T</font> <font size="-1">UNDERSTAND</font> <font size="-1">
- WHY</font> <font size="-1">NOT,</font> <font size="-1">
- DON'T.</font></p>
-
- <p>Now the explanation: the idea here is to put <em>
- perl.exe</em> in your <font size="-1">CGI</font> directory
- (however you configure that on your server), and use <font
- size="-1">URL</font> syntax like the following:</p>
- <br />
- <pre>
- <a href=
- "http://soon.to.be.a.victim.net/cgi-bin/perl.exe?myscript.pl">http://soon.to.be.a.victim.net/cgi-bin/perl.exe?myscript.pl</a>
- </pre>
-
- <p>to run <em>myscript.pl</em>. This keeps you from having to
- figure out how to configure your server to associate extensions
- like <em>.pl</em> with an interpreter like <em>
- perl.exe</em>.</p>
-
- <p>In fact, on some early Win32-based web servers (Netscape 1.x
- servers in particular), it was impossible to associate a script
- file with an interpreter. This method was recommended by
- vendors as a viable approach to running Perl scripts on your
- web server.</p>
-
- <p>Anyone with a devious mind and a little knowledge of Perl
- can see that with this configuration, hackers could start doing
- all kinds of horrible things on the server. All they'd have to
- do is send made-up URLs, using the <code>-e</code> command line
- switch in <em>perl.exe</em>, in order to do stuff like delete
- all files on a drive:</p>
- <br />
- <pre>
- <a href=
- "http://aaaugh.that.hurts.net/cgi-bin/perl.exe?-e">http://aaaugh.that.hurts.net/cgi-bin/perl.exe?-e</a>?'del%20c:\*.*%20/S%20/Q'
- </pre>
-
- <p>Of course, a true computer criminal would never do something
- so crude and obvious, but would instead use this as a launching
- point to cause irreparable harm to your organization.</p>
-
- <p>The following <font size="-1">URL</font> covers this issue
- in more depth:</p>
- <br />
- <pre>
- <a href=
- "ftp://ftp.cert.org/pub/cert_advisories/CA-96.11.interpreters_in_cgi_bin_dir">ftp://cert.org/pub/cert_advisories/CA-96.11.interpreters_in_cgi_bin_dir</a>
- </pre>
-
- <p>Tom Christiansen has also written a good discussion of the
- subject:</p>
- <br />
- <pre>
- <a href=
- "http://www.perl.com/perl/news/latro-announce.html">http://www.perl.com/perl/news/latro-announce.html</a>
- </pre>
-
- <p>Note that one suggested solution to this problem is wrapping
- your Perl script in a batch file using pl2bat or your own
- custom batch code. <font size="-1">THIS</font> <font size="-1">
- IS</font> <font size="-1">ALSO</font> <font size="-1">
- NOT</font> <font size="-1">GOOD.</font> Most of the primitive
- servers that won't allow file associations are also susceptible
- to a bug that allows a user to enter any <font size="-1">
- DOS</font> command after the bat file.</p>
-
- <p>For more information on <font size="-1">CGI</font> and web
- server security, see these URLs:</p>
- <br />
- <pre>
- Web: <a href=
- "http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html">http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html</a>
- </pre>
-
- <p>As a final note, there are so many good, free web servers
- out there for Windows <font size="-1">NT</font> and Windows 95
- that you should never stay with an old, insecure web
- server.</p>
- <br />
- <hr />
-
- <h1><a name="AUTHOR_AND_COPYRIGHT">AUTHOR AND
- COPYRIGHT</a></h1>
-
- <p>This <font size="-1">FAQ</font> was originally assembled and
- maintained by Evangelo Prodromou. <a href=
- "mailto:evangelo@endcontsw.com">evangelo@endcontsw.com.</a> It
- has been revised and updated by Brian Jepson of O'Reilly and
- Associates, and David Grove and David Dmytryshyn of
- ActiveState.</p>
-
- <p>This <font size="-1">FAQ</font> is in the public domain. If
- you use it, however, please ensure that you give credit to the
- original authors.</p>
-
- <p><!-- beginning of leaf footer--></p>
-
- <table width="100%">
- <tr>
- <td bgcolor="000000" width="70" height="31"><a href=
- "http://www.activestate.com/"><img src="ASbutton.gif" alt=
- "ActiveState Home Page" border="0" width="68" height=
- "30" /></a></td>
-
- <td width="10"> </td>
-
- <td valign="middle" bgcolor="#cc0066"><font face=
- "sans-serif" size="+1" color="#ff99cc">
- Win32 FAQ</font></td>
- </tr>
- </table>
- <!-- end of leaf footer-->
- </body>
- </html>
-
-