WARNING THIS TOPIC IS FOR TWIKI-3 AND EARLIER ONLY!!
If you are using TWiki-4, read IndigoPerlCookbook and ModPerlUnix instead; they are a lot simpler, and are more likely to get yo ua result!
-- CrawfordCurrie - 15 May 2006
Configuring ModPerl on Windows
This page provides a simple way to install a fast-running, fully-functional configuration of Twiki on Windows.
These instructions...
- represent the current "best practices" distilled from many topics. A partial list: WindowsInstallCookbook, ModPerl, ModPerlWindows, TWikiOnWindowsUsingApache, TWikiOnWindows.
- are simpler and less time-consuming than older methods.
- create a MUCH faster-running Twiki than older methods (thanks to mod_perl)
- create a fast, 100% fully-functioning Win32 port of Twiki that you can be proud to show your parents.
- are not meant for folks who have never heard of mod_perl or Apache or Perl before
- are meant for computer experts who have never fiddled with Apache, mod_perl and/or Twiki
- are written for clarity and summary, not niggling detail. That's why they don't spoon-feed you every little task. Because of the diversity of the universe, you will need to make various mental adjustments for your own install.
- are written in (hopefully) synapse-friendly outline form. Use the outline to take a lovely, refreshing birds-eye view of the structure and process.
Whenever you see a path ("N:/whatever/whatever"), change it so that it points to your files.
Note there is a bunch of useful stuff in the comments make sure you read them, and somebody someday please refactor them into the text!
Contributors
--
DavidLeBlanc
--
MartinCleaver
--
RichardDonkin
--
WolfgangTrunz
--
FrancoBagnoli
--
JeromeBouvattier
--
GladeDiviney
--
LeeBottemiller
The 4 main elements to install
Apache for Windows
ActiveState Perl
Twiki scripts
Unix-esque command-line programs
- Zip archive attached to bottom of this page
- (no installer needed, just unzip files to d:/twikiUnixSupportFiles/)
Getting the 4 elements working together
Perl --> Twiki: Equipping ActiveState Perl to run Twiki
- install 3 perl modules by typing these into the windows command line
- ppm install Net-Smtp-Multipart
- ppm install Digest-Sha1
- ppm install Mime-base64
- edit Twiki's "register" script (not needed in TWikiRelease01Feb2003 or later)
- change line 200 to this: =return $user . ':{SHA}' . MIME::Base64::encode_base64(Digest::SHA1::sha1($passwd));
Apache --> Perl: Enabling mod_perl in Apache
- install mod_perl files into both perl and apache
- Edit httpd.conf
- LoadModule
- Note: The LoadModule directive will be added when you complete a later step. Be sure to add this text at the END of httpd.conf (with AdditionsToHttpd.conf.txt)
- Add Load lines on the top
- LoadFile d:\Perl\bin\perl56.dll
- LoadModule perl_module modules/mod_perl.so
- AddModule
- find the sections with a bunch of "AddModule" lines
- Add this line:
AddModule mod_perl.c
Apache --> Perl --> Twiki: Making Apache use mod_perl to run Twiki
- Edit Apache's httpd.conf
- Copy the contents of AdditionsToHttpd.conf.txt (attached to this page) to the end of Apache's httpd.conf
- Edit the text you just added so that the paths point to where you unzipped the Twiki scripts
- Edit Twiki's .htaccess.txt
- Find .htaccess.txt in d:/twiki/bin
- Comment-out the SetHandler line
- Change this line...
- ... to this...
- Add a registry key for Perl
- Find HKEY_LOCAL_MACHINE/SOFTWARE/Perl
- Create a new string value named "sitelib"
- Set the value of "sitelib" to "d:/twiki/bin;d:/twiki/lib"
Twiki --> Unix commands: Setting paths in Twiki.cfg so Twiki can find stuff
- find these variables and (as always) enter your correct paths to the Twiki directories
-
$pubDir = "/twiki/pub";
-
$templateDir = "/twiki/templates";
-
$dataDir = "/twiki/data";
- make these changes as well
- =$safeEnvPath <-- uncomment the line
$safeEnvPath = "/cygdrive/c/cygwin/bin;/cygdrive/c/windows/system32"; and be sure to comment the other $safeEnvPath lines out
-
$lsCmd = "ls";
-
$egrepCmd = "grep -E";
-
$fgrepCmd = "grep -F";
- Running the http://yourdomain.com/bin/TestEnv (testing the new configuration)
- Be sure to add the PERL5SHELL path as specified in the TestEnv
- You may get errors that 'ls', 'rcs', 'egrep', and 'fgrep' can't be found. However that doesn't necessarily mean those executibles aren't accessible. Test this functionality in your site first before trusting TestEnv
Stuff you might find useful
Related pages
Comments
Minor update above re 01Feb2003 release and to warn about
IssuesWithPerl5dot8 and
IssuesWithApache2dot0.
I'm unclear why
ppm install Net-Smtp-Multipart
is needed - surely only Net-Smtp is required, since TWiki uses only
CPAN:Net::SMTP?
--
RichardDonkin - 10 May 2003
The LoadModule statement for httpd.conf appears to be missing from the attached file. The required statement is
LoadModule perl_module modules/mod_perl.so
--
MikeDaniel - 23 June 2003
If I use the
WindowsInstallCookbook approach of using Cygwin perl instead of
ActiveState perl do I need to change anything? Thanks.
--
MartinCleaver - 09 Jul 2003
I had problems starting Apache when, as suggested above, I copied the contents of file AdditionsToHttpd.conf.txt on
top of
httpd.conf. Nevertheless, Apache started up correctly when I copied the file to the
bottom of httpd.conf.
--
EnriqueBengoechea - 26 Sep 2003
I keep getting an error in the event viewer when I try and start apache, complaining about the fact it cannot load c:/apache/modules/mod_perl.so. I've checked that the file exists and that permissions are set correctly. Anyone else seen this?
--
NathanReeves - 02 Oct 2003
Yes, I had the same problem. Got solved by adding the LoadFile line below just before the LoadModule (adapt your path):
LoadFile d:\Perl\bin\perl56.dll
LoadModule perl_module modules/mod_perl.so
--
JeanMarieClement - 02 Oct 2003
Thanks for that. Fixed the problem.
Side Note: If you are trying to get mod_perl and mod_ntlm working with TWiki, make sure you take a look at
ExtraneousLineInHttpHeader and apply the fix referenced. If you don't do this you will find you have issues with mod_ntlm authentication.
cheers
--
NathanReeves - 03 Oct 2003
I needed the
ExtraneousLineInHttpHeader patch even without mod_ntlm.
--
JeanMarieClement - 20 Oct 2003
Though it is overall running fine, I face some strange things when using mod perl.
- Win 2k
- Apache 1.3.23
- Activestate perl 5.6.1
- cygwin RCS 5.7
Effects are:
- when directly calling the 'view' script, without specifying a web (like http://twiki.org/cgi-bin/view ), I nearly never come to the Main, but to some other page, which is to be the last page that has been visited on the server.
- I am wrongly known as the last authentified user to the TWiki scripts. Then when e.g. viewing, the entries in the twiki log mention another wiki name as mine or as guest.
There may be some others, I don't know.
As far as I understood from reading around, this is because the REMOTE_USER variable is not set (reset?) for non authenticated scripts. Indeed, editing always refers to the right twiki name.
But if I don't use modperl, I am known as TWikiGuest, not as the last authenticated user, and log entries mention guest.
It seems like solving the source of the problem is not trivial (
WhoIsTheRemoteUserInView). But is there a way that modperl behaves like non-modperl to this respect (i.e. show as guest, and not as the last user)?
--
JeanMarieClement - 20 Oct 2003
Hei! I am running TWiki with the following elements:
- Win 2k
- Apache/1.3.28 (Win32) mod_perl/1.29_01-dev
- Activestate perl 5.6.1 build 635
- cygwin RCS 5.7
- TWiki Feb2003
I started using TWiki without mod_perl, but since the performance was quite poor I decided to install it.
I followed the above instructions for the installation and everything is ok, except that I get the following warning:
[warn] Apache::Registry: T switch ignored, enable with 'PerlTaintCheck On'
I have enabled
PerlTaintCheck on the httpd.conf file, but the warning is still there. I have also declared
PERL5SHELL. I do not really know what is the problem and I have not been able to find an answer anywhere in Internet. I hope you can help me, since I am concious of the importance of having Taint Chack correctly enabled.
On the other hand, could you please tell me how I can check that Apache is actually using mod_perl? Running testenv says that mod_perl is installed, but is Apache using it?
Thank you very much!
--
HumbertoCastejon - 21 Oct 2003
Not sure about the taint checking, but see
ModPerl where a recent comment suggests
PerlSwitches -T
.
As for whether mod_perl is actually used -
testenv
has a specific check saying something like 'mod perl loaded (used for this script)', the second part indicating mod_perl actually ran the testenv script - have a look at
CVSget:bin/testenv for the part where it checks mod_perl. It also checks the mod_perl version to recommend the right
CGI.pm in the latest alpha release, downloadable from the above link - try downloading and testing this version as well (if you don't see the version then mod_perl is not running).
--
RichardDonkin - 21 Oct 2003
I saw that some of the problems I mentioned above (20. Oct 2003) had already been discussed at
ModPerlStickyPages. I wrote there for the followup
--
JeanMarieClement - 30 Oct 2003
Okay, had a problem with
RCS not working. I hadn't updated my ',v' files to change the locking user from 'nobody' to 'system'. The Windows Cookbook has a command to do this in bulk, but it doesn't appear to work with Activestate Perl.
--
NathanReeves - 10 Nov 2003
Installed TWiki on
Win2K, cf. this Cookbook incl. the above corrections. The installation is basically up&Running, BUT when clicking the Diffs or > link i get a listing ending in :
Software error: Insecure dependency in unlink while running with -T switch at
D:\TWiki\lib/TWiki/Store/RcsWrap.pm line 265. (ie. the
unlink command)
The Apache error.log says :
Unbalanced scopes: 20 more ENTERs than LEAVEs /
Unbalanced saves: 191 more saves than restores /
Unbalanced tmps: 148 more allocs than frees /
Unbalanced context: 17 more PUSHes than POPs'
Ideas for correcting this ?
--
AllanDystrup - 27 Nov 2003
Have a look at
WindowsTaintProblem. I followed the suggestion of "JeanMarieClement - 23 Oct 2003" and it worked.
I wonder why nobody else reported this problem.
--
BoerriesLudwig - 06 June 2004
Unfortunately the command
ppm install Digest-Sha1
did not work for me. Maybe it is taken off the archive? Can I get it from a different location?
C:\>ppm install Digest-Sha1
Installing package 'Digest-Sha1'...
Error installing package 'Digest-Sha1': Could not locate a PPD file for package
Digest-Sha1
The other two packages installed without problems.
Thanks, Alex
Digest-Sha1 did not work for me, but Digest::SHA1 did. -DB
--
AlexanderStedile - 23 Feb 2004
How do I "install 3 perl modules by typing these into the windows command line"?
Give me some detail.
C:\>ppm install Net-Smtp-Multipart
'ppm' is not recognized as an internal or external command,
operable program or batch file.
What do I do?
--
MindaugasIndriunas - 2004-05-26
Ok. I managed to have TWiki running this way. But It was necessary to also include the
LoadModule perl_module modules/mod_perl.so
into httpd.conf.
It seems to be working fine on
http://localhost/twiki/
But this error occurs when I try to register as a new user:
ERROR: Can't send mail using Net::SMTP (can't connect to 'mail')
--
MindaugasIndriunas - 2004-05-28
When I test my environment with "testenv", I see a lot of entries like "Warning: List program [...} not found. Check the path." Everything works fine, as I can see right now. Any ideas ?
--
BoerriesLudwig - 06 June 2004
Has anyone tried this setup using the latest version (1Sept2004)? I've managed to get everything installed (and it's all worked prev on older releases) but
RCS doesn't appear to work any more. Every document, whatever the actual revision shows up as V1.1
--
NathanReeves - 14 Oct 2004
First, I've got a 100% (it seems) working Cygwin version, but I'm wanting to speed things up, so I've now got as far as downloading mod_perl and ActiveState Perl (both 5.6 and 5.8) but just adding these lines alone:
LoadFile c:/Perl/bin/perl58.dll
LoadModule perl_module modules/mod_perl.so
gives me an error in the Apache logs when I restart Apache 2:
[Wed Nov 10 11:32:53 2004] [warn] (OS 995) [Japanese version of error text snipped] :
winnt_accept: Asynchronous AcceptEx failed.
I'm running on Japanese Win2000, but that shouldn't make any difference? Anyone got any clues? Searching Google gave hints, but no solid answer to this one.
--
KenYasumotoNicolson - 10 Nov 2004
Ahh, fixed it - first I use the suggested line above to install, but because I have spaces in my directory names, it failed to download every required file. However, I found this page
http://perl.apache.org/docs/2.0/os/win32/install.html#PPM_Packages and downloaded the
mpinstall
script, which seems long directory name friendly.
--
KenYasumotoNicolson - 11 Nov 2004
I moved my TWiki from a server to a new server. The new server was built using this discussion (Win2k3,
ActivePerl 5.6, Apache 1.3, just the GNU tools necessary, mod_perl) and the old server is Win2k, Cygwin, Cygwin Perl 5.6, Apache 1.3, no mod_perl.
The new server works great except for two things:
- The footer strip always says "Main.guest" rather than the current user
- testenv gives me a warning: "Since your CGI script is not running as user nobody, you need to change the locks in the *,v RCS files of the TWiki distribution from nobody to system. Otherwise, changes to topics will not be logged by RCS."
Any ideas? TIA
--
TonyWhite - 01 Jul 2005
- sorry - don't know - does the current user work elsewhere?
- so long as your edits are being logged in rcs, don't worry about the testenv error - it says that irrespective of whether it is a problem or not (its quite hard to check every ,v file to see if its correct - thankfully this whole issue is avoided in DevelopBranch)
--
SvenDowideit - 01 Jul 2005
I think my
RCS is not working. I've tried making changes in some topics and have found that the revision footer bar is not changing. Also, I've created a new topic in the Sandbox, saved it, then made changes and save those. There were no changes in revision list and, upon looking in the /data/Sandbox directory, I don't even see a .txt,v file for the topic.
I'm going to go back over my config for
RCS, but it seems like I've done this a few times already. Anyone else have an idea what I should look for? Do I need to create an .htaccess file in the
UnixSupportTools directory (where
RCS resides)?
--
TonyWhite - 05 Jul 2005
- nope (to the .htaccess file)
I would expect some info in the debug.txt, or warning.txt, but at this point it really all depends. and ifyou don't see a ,v file, then its pretty much either the rcs setup, or your version of rcs (is there an
RCS dir by any chance?)
the other option you have is to use
RcsLite - which tries to implement in perl what rcs does.. its slower, and in Cairo slightly buggy, but i've used it in the past without noticing any problems
--
SvenDowideit - 06 Jul 2005
Sven, thanks very much BTW for helping me out. OK, here's what I've found out:
- debug.txt looks good - mostly it's SessionPlugin initializing UserHandler
- warnings.txt - no warnings, mostly it's the ActionTrackerPlugin initializing
- My RCS directory (I assume you mean the location of rcs?) is simply d:/twikiUnixSupportFiles
However, I started checking back in the Apache error.log file and I found some interesting things. Most of the entries look similar to this:
Use of uninitialized value in require at d:/twiki/bin/view line 34. |
[Wed Jul 6 09:37:15 2005] view: Use of uninitialized value in require at d:/twiki/bin/view line 35. |
[Wed Jul 6 09:37:15 2005] CGI.pm: Use of uninitialized value in require at d:/Perl/lib/CGI.pm line 27. |
[Wed Jul 6 09:37:15 2005] CGI.pm: Use of uninitialized value in require at d:/Perl/lib/CGI.pm line 30. |
But what's more interesting is the following entries:
[Wed Jul 6 09:37:16 2005] nul: Use of uninitialized value in require at d:\twiki\lib/TWiki/Plugins/ActionTrackerPlugin.pm line 75. |
'd:/twiki/data/TWiki/RCS/WebHome.txt,v',v: Invalid argument |
rlog: Use of uninitialized value in require at d:/twiki/bin/view line 34. |
and
[Wed Jul 6 10:08:32 2005] nul: Use of uninitialized value in require at d:\twiki\lib/TWiki/Plugins/ActionTrackerPlugin.pm line 75. |
'd:/twiki/data/TWiki/RCS/WebHome.txt,v',v: Invalid argument |
rlog: 'd:/twiki/data/Sandbox/RCS/WebHome.txt,v',v: Invalid argument |
rlog: 'C:\temp\RCS/twikiAttachmentsyEQkD,v',v: No such file or directory |
rcs: 'C:\temp\RCS/twikiAttachmentsyEQkD',v: Invalid argument |
co: |
Now, perhaps I don't understand how RCS is being called by Apache... but just reading the log literally I'm confused: there is no 'd:/twiki/data/RCS' directory. Strange to me.
As far as RCS settings, I have this in the httpd.conf in the <IfModule mod_env.c> section:
SetEnv TZ GMT0BST
SetEnv RCSINIT -x,v/
# Adjust TEMP and TMP for your server and create directories if necessary
SetEnv TEMP c:/temp
SetEnv TMP c:/temp
SetEnv LOGNAME system
SetEnv HOME d:/twiki
SetEnv USER "system"
and this in the TWiki.cfg file:
$safeEnvPath = "d:/twikiUnixSupportFiles;c:/WINNT/system32"; # Unix/Linux
#
$rcsDir = 'd:/twikiUnixSupportFiles'; # Unix, Linux and Cygwin
# Initialise RCS file, ignored if empty string,
# needed on Windows for binary files. Added JET 22-Feb-01
$rcsArg = "";
$rcsArg = "-x,v" if( $OS eq "WINDOWS" );
#
$useRcsDir = "0";
# This should enable gathering of extra error information on most OSes. However, won't work on NT4 unless unix like shell is used
$endRcsCmd = "";
$endRcsCmd = " 2>&1" if( $OS eq "UNIX" );
# Command quote ' for unix, \" for Windows
$cmdQuote = "'";
$cmdQuote = "\"" if( $OS eq "WINDOWS" );
#
$storeTopicImpl = "RcsWrap";
As you can see, I'm using RCSWrap, not RCSLite. Am I missing anything or have I misconfigured anything?
NEW: OK, I just changed from RCSWrap to RCSLite and the revision control process appears to be working now. So it's definitely my RCS setup, but I just can't see what I've done wrong.
--
TonyWhite - 06 Jul 2005
Tony, I don't think you've specifically done anything wrong - i think that your version of rcs wants to put the ,v files into an
RCS directory belor where the .txt file lives. thats all
you would probably need to create those direcotries - but i don't really know - personally, unless you have issues (performance or so)
RcsLite should probley be worth using on windows
--
SvenDowideit - 06 Jul 2005
An alternative is to install
IndigoPerl. That pre-integrates Apache/Perl and
ModPerl.
--
MartinCleaver - 05 Aug 2005
I decided to upgrade my
TWikiRelease01Dec2001 setup towards
TWikiRelease02Sep2004. In the process I found a nasty bug in the
RCS GNU port. See
RCSWrapCorruptsMyTopicsHistory. I'm surprised to be the only one. Given it's so easy to trigger the bug for me.
Well, I ended up using Cygwin
RCS. Which works correctly so far.
--
JeromeBouvattier - 21 Sep 2005