Attached. Updated to reflect the ppm packages kindly provided by Randy
Kobes.
--
Andrew O'Brien
Senior Engineer email: [EMAIL PROTECTED]
Switch Online Group Pty Limited phone: +61 2 9299 1133
ABN 89 092 286 327 fax: +61 2 9299 1134
$Id: Embperl_IIS_Howto.txt,v 1.1 2002/03/24 23:29:23 Administrator Exp $
This document describes how to get Embperl running under Microsoft's
IIS. Please note the following:
1. There are two ways in which you can set things up to call embperl
pages, either with the CGI in the path:
http://localhost/cgi-bin/embpcgi.pl/path/to/mypage.epl
or with a mapping that runs the cgi for you behind the scenes:
http://localhost/path/to/mypage.epl
So far, I haven't been able to get Embperl running straight
through the cgi directly so this guide currently only explains
the second approach.
If someone can provide the necessary options which need to be
changed and their values (with some reference to what I've set up
here) then I'll test and add them to this document quickly.
2. This works for HTML::Embperl 1.3.4 and IIS 5.0 on Windows 2000
server. I haven't tried it with other combinations. It should be
more or less the same for the upcoming Embperl 2.0 release but
I haven't tested this yet.
3. This may seem HTML::Embperl specific. It should work just as well
for HTML::EmbperlObject sites, simply replace all references to
embpcgi.pl with epocgi.pl
One note for Embperl Object sites: I've found in the past that
having different extensions for public files (i.e. direct URLs)
and internal include files (such as the base file) is a good way to
go. This way you can make sure that people can't see your internally
used files, just the ones you want them to.
Install necessary software
~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Make sure you have IIS running on the host in question and that it
is started as a service automatically on reboot. This is the
default as far as I am aware.
2. You'll need a perl distribution from somewhere. I recommend
ActiveState strongly but others will work, I'm sure.
http://www.activestate.com/Products/ActivePerl/
If you have IIS running already when you install this perl
distribution then you should get prompted to install a few perl
extensions/associations in IIS. Say yes.
3. You'll need a version of HTML::Embperl compiled *WITHOUT*
apache/mod_perl support. Randy Kobes has kindly provided a version
of HTML::Embperl (1.3.4) compiled for both environments. To install
this ppm file using ActiveStates ppm command (this assumes you are
running ppm3, the process is similar for earlier versions so read the
help documentation from within the version you are using):
* add this repository to your list:
"rep add theoryx5 http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer"
* select this repository to be the default for this session.
<number> is the repository number corresponding to theoryx5:
"rep <number>"
* install HTML::Embperl:
"install HTML-Embperl"
For those not using ActiveState or wanting to compile the module
themselves for security reasons, read below. Others can safely skip
to the next step.
Make sure you have Visual Studio/Dev Studio installed or something
similar that provides a commandline C compiler. I did this with
Visual Studio 6.0 installed but it should work with other versions
with working C compilers.
To compile:
1. Download and unpack the .tar.gz from
ftp://ftp.dev.ecos.de/pub/perl/embperl/
2. Start->run->command to bring up a dos prompt.
3. "cd \path\to\unpacked\embperl"
4. Assuming perl is correctly installed:
"perl Makefile.PL"
Answer no to the question about support for Apache/mod_perl
5. "nmake" to compile Embperl
6. "nmake test" to check that all is fine. All tests should pass
7. "nmake install" to install into your perl tree
8. You're done installing Embperl.
Configuring IIS
~~~~~~~~~~~~~~~
As noted above, this is for windows 2000. I have little experience
with windows so I can't tell you how 2000-specific this is - others
will have to contribute alternatives for other windows versions.
1. Open up the Management Console by right clicking on "My Computer" and
selecting "Manage"
2. Create a new site. Skip this step if you want to configure an
existing site! Right click on Internet Information Services (within
the Services and Applications group) and select New->Web site.
Enter a description, hit next
IP Address etc: most things here can be left as default for
development. If you know what you're doing then set this up
appropriately. Hit next.
Choose a path to the web site's home directory. (You may need to
create this directory beforehand). This is where the content of
this site lives. I'd suggest choosing something like:
"c:\mysitename\wwwroot" as this allows you to create associated
directories in "c:\mysitename" that aren't visible via the website.
Hit next.
Permissions: Allow "Read" and "Run scripts"
3. Configure your site.
1. Optionally create a "cgi-bin" (or "scripts" or whatever)
subdirectory for your own cgi scripts if you have any. If you
want to share scripts directories with multiple sites then
create a virtual directory - else just a normal directory in the
file system should be OK.
Make sure that the directory properties are set to execute
scripts.
This is not necessary for anything other than convenience as
with the mappings outlined below you can have mixed
static/script content in any directory with script execute
permissions set.
2. Associate perl scripts. This is not strictly necessary if you
are just running an embperl-only site but it doesn't hurt.
You have two options: either associate with the ActiveState perl
dll or with the perl.exe itself. Associating with the dll is
faster but they both work just as well.
Right click on the <mysite> icon in the Management Console
(within Internet Information Services) and choose
properties. Click on the "Home Directory" tab and the
"Configuration" button within "Application Settings".
(This might be already there from the perl installation). Add
the following Application mapping (use whatever extension you
like. I just happen to like .pl):
Executable: "c:\perl\bin\perlis.dll"
(or "c:\perl\bin\perl.exe %s %s". Note the two
space-separated "%s" strings for this option. They
must be lower case)
Extension: ".pl"
Verbs: Limit to: "GET,HEAD,POST"
Tick the "script engine" box. Basically this means that all .pl
files are now scripts and not executables.
Tick the "Check that file exists" box. Someone mentioned that
unchecking this will allow the CGI-style paths to work but it
didn't change anything for me. YMMV.
3. Associate Embperl files with the embperl CGI.
First, copy the embpcgi.pl file from your perl installation
somewhere so you can customise this for your site. I recommend
"C:\mysite\embpcgi.pl" as this script is probably
site-specific. The file is usually installed in the HTML/
directory of your perl installation. For me (using activestate
perl) this was: c:\perl\site\lib\HTML\embpcgi.pl
Again, go to the site Application mapping settings and add:
Executable: "C:\perl\bin\perl.exe c:\mysite\embpcgi.pl %s"
Note: Only one "%s" is required.
Extension: ".epl" (This can be whatever you like, .epl is my
preference)
Verbs: Limit to: "GET,HEAD,POST"
Tick the "script engine" box and the "Check that file exists"
box.
Configure Embperl for your site
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Every site is different. Having a separate embpcgi.pl for each one is
just one way of doing it. This is perl, remember, so you can get the
configuration directives from wherever you like. What follows is a
simple example - you may well need something different if you've got
lots of virtual hosts or some other complication.
An easy way to configure your embpcgi.pl file is to add a BEGIN {}
block with all the Embperl config directives. You shouldn't have to
touch anything else for simple sites.
Eg.
BEGIN {
use Env;
$ENV{EMBPERL_LOG} = $ENV{TEMP}.'\embperl.log';
# HTML::Embperl::optRawInput + HTML::Embperl::optAllFormData;
$ENV{EMBPERL_OPTIONS} = 8208;
# HTML::Embperl::dbgSession + HTML::Embperl::dbgImport +
# HTML::Embperl::dbgDefEval + HTML::Embperl::dbgLogLink +
# HTML::Embperl::dbgInput + HTML::Embperl::dbgTab +
# HTML::Embperl::dbgForm + HTML::Embperl::dbgCmd +
# HTML::Embperl::dbgEval + HTML::Embperl::dbgStd
$ENV{EMBPERL_DEBUG} = 39862509;
#$ENV{EMBPERL_DEBUG} = 0;
$ENV{EMBPERL_SESSION_HANDLER_CLASS} = 'no';
}
This was enough to get me going. I didn't need session handling or
anything funky. You'll probably want to customise this - read the
Embperl docs (http://perl.apache.org/embperl) for more information.
Happy Embperling,
Andrew O'Brien
andrewo+embperl at switchonline.com.au
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]