Tags:
create new tag
, view all tags

SID-00964: configure chicken-and-egg problem after disabling mod_perl

Status: Answered Answered TWiki version: 5.0.0 Perl version: 5.8.8
Category: CategoryInstallation Server OS: openSUSE 10.2 with Plesk 8.3 Last update: 7 years ago

I've been trying for days to get configure to work. I think it comes down to the mod_perl chicken-and-egg problem. I'm on Linux (openSuse) running Apache 2.2.3. I've tried disabling mod_perl by removing it from APACHE_MODULES in /etc/sysconfig/apache2 and removing mod_perl.conf from /etc/apache2/conf.d. Both ways, when I create /etc/apache2/conf.d/twiki.conf and then restart apache (apache2ctl -k restart), it doesn't restart correctly and no pages display. Looking in /var/log/apache2/error_log always has that "Content-type: text/plain\n\nPerl error when reading LocalSite.cfg" error. Can anyone suggest a proper form of action? I'm trying to disable mod_perl so I can configure twiki, and the instructions say it MUST be disabled before I can configure twiki. I guess I need to know how to disable mod_perl and how to confirm that it is disabled. Both methods above didn't seem to work out.

-- MatthewTaft - 2010-09-09

Discussion and Answer

The issue you describe is not a mod_perl issue. You actually do not need to remove/uninstall mod_perl from Apache, what the docs meant to convey is to not enable mod_perl for the TWiki scripts. That is, don't add directives SetHandler perl-script, PerlResponseHandler ModPerl::Registry to the <Directory "/var/www/twiki/bin"> section. In fact, unless you have thousands of users I do not recommend using mod_perl. Details in ApacheConfigGenerator (which I recommend to use).

As for "Content-type: text/plain\n\nPerl error when reading LocalSite.cfg" error, I have never seen it, so I only can guess. The twiki/lib/LocalSite.cfg file gets generated the first time you run the configure script in your browser. Make sure that the twiki/lib/ directory is writable by your Apache user (wwwrun on Suse?).

-- PeterThoeny - 2010-09-09

Hi Peter, thanks for the advice. I'm totally stumped here. I hope you won't mind if I provide more detailed information. I figure the more info I provide, the better chances of someone discovering where I've screwed this up.

I used the ApacheConfigGenerator and copied the resulting confi info into /etc/apache2/conf.d/twiki.conf. (Notice I commented out the whole <IfModule mod_perl.c> section in the <Directory ".../bin"> section so that mod_perl would not be enabled for the TWiki scripts. Did I do this right?

# Autogenerated httpd.conf file for TWiki. # Generated at http://twiki.org/cgi-bin/view/TWiki/ApacheConfigGenerator

# We set an environment variable called blockAccess. # # Setting a BrowserMatchNoCase to ^$ is important. It prevents TWiki from # including its own topics as URLs and also prevents other TWikis from # doing the same. This is important to prevent the most obvious # Denial of Service attacks. # # You can expand this by adding more BrowserMatchNoCase statements to # block evil browser agents trying the impossible task of mirroring a twiki # # Example: # BrowserMatchNoCase ^SiteSucker blockAccess # BrowserMatchNoCase ^$ blockAccess

BrowserMatchNoCase ^Accoona blockAccess BrowserMatchNoCase ^ActiveAgent blockAccess BrowserMatchNoCase ^Attache blockAccess BrowserMatchNoCase BecomeBot blockAccess BrowserMatchNoCase ^bot blockAccess BrowserMatchNoCase Charlotte/ blockAccess BrowserMatchNoCase ^ConveraCrawler blockAccess BrowserMatchNoCase ^CrownPeak-HttpAgent blockAccess BrowserMatchNoCase ^EmailCollector blockAccess BrowserMatchNoCase ^EmailSiphon blockAccess BrowserMatchNoCase ^e-SocietyRobot blockAccess BrowserMatchNoCase ^Exabot blockAccess BrowserMatchNoCase ^FAST blockAccess BrowserMatchNoCase ^FDM blockAccess BrowserMatchNoCase ^GetRight/6.0a blockAccess BrowserMatchNoCase ^GetWebPics blockAccess BrowserMatchNoCase ^Gigabot blockAccess BrowserMatchNoCase ^gonzo1 blockAccess BrowserMatchNoCase ^Google\sSpider blockAccess BrowserMatchNoCase ^ichiro blockAccess BrowserMatchNoCase ^ie_crawler blockAccess BrowserMatchNoCase ^iGetter blockAccess BrowserMatchNoCase ^IRLbot blockAccess BrowserMatchNoCase Jakarta blockAccess BrowserMatchNoCase ^Java blockAccess BrowserMatchNoCase ^KrakSpider blockAccess BrowserMatchNoCase ^larbin blockAccess BrowserMatchNoCase ^LeechGet blockAccess BrowserMatchNoCase ^LinkWalker blockAccess BrowserMatchNoCase ^Lsearch blockAccess BrowserMatchNoCase ^Microsoft blockAccess BrowserMatchNoCase ^MJ12bot blockAccess BrowserMatchNoCase MSIECrawler blockAccess BrowserMatchNoCase ^MSRBOT blockAccess BrowserMatchNoCase ^noxtrumbot blockAccess BrowserMatchNoCase ^NutchCVS blockAccess BrowserMatchNoCase ^RealDownload blockAccess BrowserMatchNoCase ^Rome blockAccess BrowserMatchNoCase ^Roverbot blockAccess BrowserMatchNoCase ^schibstedsokbot blockAccess BrowserMatchNoCase ^Seekbot blockAccess BrowserMatchNoCase ^SiteSnagger blockAccess BrowserMatchNoCase ^SiteSucker blockAccess BrowserMatchNoCase ^Snapbot blockAccess BrowserMatchNoCase ^sogou blockAccess BrowserMatchNoCase ^SpiderKU blockAccess BrowserMatchNoCase ^SpiderMan blockAccess BrowserMatchNoCase ^Squid blockAccess BrowserMatchNoCase ^Teleport blockAccess BrowserMatchNoCase ^User-Agent\: blockAccess BrowserMatchNoCase VoilaBot blockAccess BrowserMatchNoCase ^voyager blockAccess BrowserMatchNoCase ^W3C blockAccess BrowserMatchNoCase ^w3search blockAccess BrowserMatchNoCase ^Web\sDownloader blockAccess BrowserMatchNoCase ^WebCopier blockAccess BrowserMatchNoCase ^WebDevil blockAccess BrowserMatchNoCase ^WebSec blockAccess BrowserMatchNoCase ^WebVac blockAccess BrowserMatchNoCase ^Webwhacker blockAccess BrowserMatchNoCase ^Webzip blockAccess BrowserMatchNoCase ^Wells blockAccess BrowserMatchNoCase ^WhoWhere blockAccess BrowserMatchNoCase www\.netforex\.org blockAccess BrowserMatchNoCase ^WX_mail blockAccess BrowserMatchNoCase ^yacybot blockAccess BrowserMatchNoCase ^ZIBB blockAccess BrowserMatchNoCase ^$ blockAccess

<IfModule mod_perl.c> # Mod_perl preloading PerlRequire /srv/www/vhosts/[domainname]/subdomains/twiki/httpdocs/tools/mod_perl_startup.pl PerlSwitches -T </IfModule>

# The ScriptAlias defines the bin directory as a directory where CGI # scripts are allowed. # The first parameter will be part of the URL to your installation e.g. # http://example.com/twiki/bin/view/... # The second parameter must point to the physical path on your disc. ScriptAlias /twiki/bin "/srv/www/vhosts/[domainname]/subdomains/twiki/httpdocs/bin"

# The Alias defines a url that points to the twiki pub directory, which # is the root of file attachments. Alias /twiki/pub "/srv/www/vhosts/[domainname]/subdomains/twiki/httpdocs/pub"

# This specifies the options on the TWiki scripts directory. The ExecCGI # and SetHandler tell apache that it contains scripts. "Allow from all" # lets any IP address access this URL. <Directory "/srv/www/vhosts/[domainname]/subdomains/twiki/httpdocs/bin"> AllowOverride None Order Allow,Deny Allow from all Deny from env=blockAccess

Options ExecCGI FollowSymLinks SetHandler cgi-script

# Password file for TWiki users AuthUserFile /srv/www/vhosts/[domainname]/subdomains/twiki/httpdocs/data/.htpasswd AuthName 'Enter your WikiName: (First name and last name, no space, no dots, capitalized, e.g. JohnSmith)' AuthType Basic

# File to return on access control error (e.g. wrong password) ErrorDocument 401 /twiki/bin/view/TWiki/TWikiRegistration

# Limit access to configure to specific IP addresses and or users. # Make sure configure is not open to the general public. # It exposes system details that can help attackers. <FilesMatch "^(configure)$"> SetHandler cgi-script Order Deny,Allow Allow from all </FilesMatch>

# Enable mod_perl for the bin scripts listed # <IfModule mod_perl.c> # <FilesMatch \"(attach|edit|manage|rename|save|upload|view|rest|.*auth).*\"> # SetHandler perl-script # PerlResponseHandler ModPerl::Registry # PerlSendHeader On # PerlOptions +ParseHeaders # </FilesMatch> # </IfModule> </Directory>

# This sets the options on the pub directory, which contains attachments and # other files like CSS stylesheets and icons. AllowOverride None stops a # user installing a .htaccess file that overrides these options. # Note that files in pub are not protected by TWiki Access Controls, # so if you want to control access to files attached to topics you need to # block access to the specific directories same way as the ApacheConfigGenerator # blocks access to the pub directory of the Trash web <Directory "/srv/www/vhosts/[domainname]/subdomains/twiki/httpdocs/pub"> Options None AllowOverride None Order Allow,Deny Allow from all Deny from env=blockAccess

# Disable execusion of PHP scripts php_admin_flag engine off

# This line will redefine the mime type for the most common types of scripts AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi # #add an Expires header that is sufficiently in the future that the browser does not even ask if its uptodate # reducing the load on the server significantly #IF you can, you should enable this - it will improve your twiki experience, even if you set it to under one day. # you may need to enable expires_module in your main apache config expires_module libexec/httpd/mod_expires.so mod_expires.c #<ifmodule mod_expires.c> # <filesmatch "\.(jpg|gif|png|css|js)$"> # ExpiresActive on # ExpiresDefault "access plus 11 days" # </filesmatch> #</ifmodule> #

</Directory>

When I write this file and restart apache, it doesn't restart successfully (no pages are accessible on the web server, not even our livewatch.php script on another domain).

As to LocalSite.cfg: This file has still not been created in twiki/lib. I've recursively set ownership to the twiki directory to wwwrun:www, and the current recursive permissions of lib are drwxrwxr-x.

The exact error in /var/log/apache2/error_log is:

[Thu Sep 09 21:04:10 2010] [error] Content-type: text/plain\n\nPerl error when reading LocalSite.cfg: \nPlease inform the site admin.\nBEGIN failed--compilation aborted at /srv/www/vhosts/[domainname]/subdomains/twiki/httpdocs/lib/TWiki.pm line 523.\nCompilation failed in require at /srv/www/vhosts/[domainname]/subdomains/twiki/httpdocs/bin/attach line 41.\nBEGIN failed--compilation aborted at /srv/www/vhosts/[domainname]/subdomains/twiki/httpdocs/bin/attach line 41.\nCompilation failed in require at (eval 7) line 1.\n

-- MatthewTaft - 2010-09-09

Hi again Peter,

I was able to solve my own problem here. I had to comment out another section of the config file. In this section:

<IfModule mod_perl.c> # Mod_perl preloading PerlRequire /srv/www/vhosts/mynayoki5.de/subdomains/twiki/httpdocs/tools/mod_perl_startup.pl PerlSwitches -T </IfModule>

I commented out the directive that requires the mod_perl_start.pl script, but kept the PerlSwitches -T directive. Now it looks like this:

<IfModule mod_perl.c> # Mod_perl preloading # PerlRequire /srv/www/vhosts/mynayoki5.de/subdomains/twiki/httpdocs/tools/mod_perl_startup.pl PerlSwitches -T </IfModule>

when restarting apache, now everything works! Thanks again.

-- MatthewTaft - 2010-09-09

I am glad it worked out.

We need to update the ApacheConfigGenerator with a checkbox to enable/disable mod_perl.

-- PeterThoeny - 2010-09-09

Hi Peter,

Good idea. I updated the ApacheConfigGenerator to include a checkbox for specifically "enabling" mod_perl. When not checked, the directives in the twiki.conf file are not written. There is still some more documentation below "mod_perl startup script" that someone could touch up... the information actually only applies when someone specifically checks the box to "enable" the start up script.

-- MatthewTaft - 2010-09-09

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title configure chicken-and-egg problem after disabling mod_perl
SupportCategory CategoryInstallation
TWiki version 5.0.0
Server OS openSUSE 10.2 with Plesk 8.3
Web server Apache 2.2.3
Perl version 5.8.8
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2010-09-09 - MatthewTaft
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.