Question
How to configure TWiki to run with
mod_perl on
RedHat 9.0
Environment
| TWiki version: |
20030201 |
| TWiki plugins: |
Default |
| Server OS: |
RedHat 9.0 |
| Web server: |
Apache 2.0.40 |
| Perl version: |
5.8.0 |
| Client OS: |
not relevant |
| Web Browser: |
not relevant |
--
AleksanderAdamowski - 09 Oct 2003
Answer
After installing from
TWikiRPMs, do the following:
1) Append TWiki's bin directory to @INC
Create
/etc/httpd/conf/startup.pl with the following contents:
#!/usr/bin/perl -wT
unshift @INC, '/home/twiki/bin';
2) Make Apache run the file on startup by adding this at the end of httpd.conf:
PerlRequire /etc/httpd/conf/startup.pl
3) Edit TWiki's bin/setlib.cfg
Change
twikiLibPath to be absolute:
$twikiLibPath = '/home/twiki/lib';
4) Set the handler for TWiki to mod_perl in /etc/httpd/conf.d/twiki.conf:
<FilesMatch "^(view|preview)$">
SetHandler perl-script
PerlHandler ModPerl::Registry::handler
Options ExecCGI
PerlSendHeader On
</FilesMatch>
5) Turn off Perl taint checking in /etc/httpd/conf.d/perl.conf:
PerlTaintCheck Off
--
AleksanderAdamowski - 09 Oct 2003
Thanks for documenting this! I've updated the
TWikiRPMs link above - see also
TWikiOnRedHat and
ModPerlUnix.
Could you provide some testenv output or a link? I'm interested to find out whether the code in
ModPerlOnRedHat80 worked, i.e. it recommends a CGI.pm upgrade (though perhaps Red Hat 9.0 already has the right version of CGI.pm). Either way, testenv would help.
--
RichardDonkin - 09 Oct 2003
Testenv output:
Test the environment for TWiki
Please read the TWikiInstallationNotes for more information on TWiki installation.
Environment variables:
AUTH_TYPE Basic
DOCUMENT_ROOT /var/www/html
GATEWAY_INTERFACE CGI/1.1
HTTPS on
HTTP_ACCEPT text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_ACCEPT_ENCODING gzip,deflate
HTTP_ACCEPT_LANGUAGE en-us,en;q=0.5
HTTP_CONNECTION keep-alive
HTTP_HOST twiki.altkom.pl
HTTP_KEEP_ALIVE 300
HTTP_USER_AGENT Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.4) Gecko/20030630
LDAP_USER olo
MOD_AUTH_LDAP_VERSION 2.12
PATH /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
QUERY_STRING
REMOTE_ADDR 192.168.254.74
REMOTE_PORT 35031
REMOTE_USER olo
REQUEST_METHOD GET
REQUEST_URI /twiki/bin/testenv
SCRIPT_FILENAME /home/twiki/bin/testenv
SCRIPT_NAME /twiki/bin/testenv
SERVER_ADDR 192.168.254.20
SERVER_ADMIN a.adamowski@altkom.pl
SERVER_NAME twiki.altkom.pl
SERVER_PORT 443
SERVER_PROTOCOL HTTP/1.1
SERVER_SIGNATURE
Apache/2.0.40 Server at twiki.altkom.pl Port 443
SERVER_SOFTWARE Apache/2.0.40 (Red Hat Linux)
UNIQUE_ID NxM3M38AAAEAAFDzBY8AAAAA
CGI Setup:
Operating system: Unix (linux)
Perl version: 5.8.0
@INC library path: /home/twiki/lib
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
.
Note: This is the Perl library path, used to load TWiki modules, third-party modules used by some plugins, and Perl built-in modules.
TWiki module in @INC path:
OK, TWiki.pm found (TWiki version: 01 Feb 2003)
Required Perl modules:
CGI (2.89)
CGI::Carp (1.24)
File::Copy (2.05)
Optional Perl modules:
Algorithm::Diff (1.01)
MIME::Base64 (2.12)
POSIX (1.05)
PATH_INFO:
Note: For a URL such as https://twiki.altkom.pl/twiki/bin/testenv/foo/bar, the correct PATH_INFO is /foo/bar, without any prefixed path components. Test this now - particularly if you are using Apache or IIS, or are using a web hosting provider. The page resulting from the test link should have a PATH_INFO of /foo/bar.
mod_perl: Not used for this script (mod_perl not loaded)
User: apache
Note: Your CGI scripts are executing as this user.
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 apache. Otherwise, changes to topics will not be logged by RCS.
Group(s): apache confbekap apache
Test of TWiki.cfg Configuration:
$wikiHomeUrl: http://infra.altkom.pl/twiki
Note: This is the link of the TWiki icon in the upper left corner.
$defaultUrlHost: http://twiki.altkom.pl
Note: This must be the protocol and host part (with optional port number) of the TWiki URL.
$scriptUrlPath: /twiki/bin
Note: This must be the URI of the TWiki cgi-bin directory.
$pubUrlPath: /twiki/pub
Note: This must be the URI of the public directory.This is not set correctly if the /twiki/pub/wikiHome.gif image below is broken:
$pubDir: /home/twiki/pub
Note: This is the public directory, as seen from the file system. It must correspond to $pubUrlPath.
$templateDir: /home/twiki/templates
Note: This is the TWiki template directory, as seen from the file system.
Warning: Security issue: This directory should not be writable by the apache user.
$dataDir: /home/twiki/data
Note: This is the data directory where TWiki stores all topics.
$mailProgram: /usr/sbin/sendmail -t -oi -oeq
Note: This is the mail program TWiki uses to send mail.
$rcsDir: /usr/bin
Note: This is the directory where RCS is located.
RCS Version: 5.7
Note: This is the version of RCS which will be used.
$lsCmd: /bin/ls
Note: This is the file list program TWiki uses to list topics.
$egrepCmd: /bin/egrep
Note: This is a program TWiki uses for search.
$fgrepCmd: /bin/fgrep
Note: This is a program TWiki uses for search.
$safeEnvPath: /bin:/usr/bin
Note: This is used to initialise the PATH variable, and is used to run the 'diff' program used by RCS, as well as to run shell programs such as Bourne shell or 'bash'.
Path and Shell Environment
Original PATH: /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
Note: This is the PATH value passed in from the web server to this script - it is reset by TWiki scripts to the PATH below, and is provided here for comparison purposes only.
Current PATH: /bin:/usr/bin
Note: This is the actual PATH setting that will be used by Perl to run programs. It is normally identical to $safeEnvPath, unless that variable is empty.
diff: GNU diff was found on the PATH - this is the recommended diff tool.
Note: The 'diff' command is used by RCS to compare files.
Internationalisation and Locale Setup
$useLocale: 1
Note: This TWiki.cfg setting controls whether locales are used by Perl and 'grep'.
$siteLocale: pl_PL.UTF-8
Note: This TWiki.cfg parameter sets the site-wide locale - for example, de_AT.ISO-8859-1 where 'de' is the language code, 'AT' the country code and 'ISO-8859-1' is the character set. Use the locale -a command on your system to determine available locales.
Btw, I've forgotten about turning off Perl taint check. Added this to my description.
--
AleksanderAdamowski - 13 Oct 2003
Thanks for the testenv output. Note that *.UTF-8 locales are not really supported in TWiki as of
TWikiRelease01Feb2003, though some people may find they work OK for certain character sets. See
ProposedUTF8SupportForI18N for plans to support UTF-8 properly - the alpha has some support already.
Also, turning off taint checking is not desirable for security reasons - this bypasses a lot of checks that help to make sure your CGI setup is secure (see
SecureSetup). It would be better to find a way of using
ModPerl without turning this off.
--
RichardDonkin - 16 Oct 2003
I had a problem with long topics that where masacrated when previewing (text cut off after about 8kB). After some research i realized that this was a problem with the mod_perl version installed. I upgraded mod_perl from 1.99_07 to 1.99_09, but then ended up with a problem that the registry module could not be found. Following error message appeared.
[Thu May 20 12:47:15 2004] [error] [client X.X.X.X] Can't locate ModPerl/Registry/handler.pm in @INC (@INC contains: /home/twiki/bin /usr/lib/perl5/site_
perl/5.8.0/i386-linux-thread-multi/Apache2 /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Apache2 /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/
lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.
0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 . /etc
/httpd/ /etc/httpd/lib/perl) at (eval 3) line 3.!
Solved the problem by pointing the perl handler to
ModPerl::Registry.
PerlHandler ModPerl::Registry
I've spend to much time on this, i hope that if you run into this problem you find this little comment
Other small remark: If you install a new mod_perl version (1.99_XX) without compatibility mode, remember that apaches directive
PerlSendHeader On is not supported anymore, use
ParseHeaders instead.
--
StephanChristen - 20 May 2004
For those who have moved past Red Hat 9.0, there's a related support topic at
ModPerlOnFedoraCore2.
--
GarethEdwards - 08 Jun 2004
I've also had the problem with text being truncated. It turns out the version of mod_perl that comes with Redhat 9 causes this. To solve it, upgrade. You can do it very easily with RPM's found here:
http://www.apache.org/~gozer/mp2/
Enjoy... it took me a LONG time to find this
--
MarcusVorwaller - 02 Nov 2004