error_log file, it should give you the error message. Or, try to run the view script from the shell level to see what kind of compile error you get.
-- PeterThoeny - 03 Mar 2003
As always, following the SupportGuidelines, which mention the Apache error_log as a key source of information, will help you get your problem solved as quickly as possible. The other thing to do is to use diff to detect changes made in your TWiki.cfg compared to the standard one in the ZIP file for TWiki release.
-- RichardDonkin - 05 Mar 2003
21 use CGI::Carp qw( fatalsToBrowser );
22 use CGI;
23 use lib ( '.' );
24 use lib ( '../lib' );
25 use TWiki;
26
27 use strict;
28
There is no BEGIN on line 27?!?!
The diff produces:
--- 58c58 < $wikiHomeUrl = "http://www.meru.org.uk/twiki"; -- > $wikiHomeUrl = "http://your.domain.com/twiki"; 60c60 < $defaultUrlHost = "http://www.meru.org.uk"; -- > $defaultUrlHost = "http://your.domain.com"; 66c66 < $pubDir = "/var/www/twiki/pub"; -- > $pubDir = "/home/httpd/twiki/pub"; 68c68 < $templateDir = "/var/www/twiki/templates"; -- > $templateDir = "/home/httpd/twiki/templates"; 70c70 < $dataDir = "/var/www/twiki/data"; -- > $dataDir = "/home/httpd/twiki/data"; 110c110 < $mailProgram = "/usr/sbin/sendmail -t -oi -oeq -f speechmakers/@meru.org. uk"; -- > $mailProgram = "/usr/sbin/sendmail -t -oi -oeq"; 58c58 < $wikiHomeUrl = "http://www.meru.org.uk/twiki"; -- > $wikiHomeUrl = "http://your.domain.com/twiki"; 60c60 < $defaultUrlHost = "http://www.meru.org.uk"; -- > $defaultUrlHost = "http://your.domain.com"; 66c66 < $pubDir = "/var/www/twiki/pub"; -- > $pubDir = "/home/httpd/twiki/pub"; 68c68 < $templateDir = "/var/www/twiki/templates"; -- > $templateDir = "/home/httpd/twiki/templates"; 70c70 < $dataDir = "/var/www/twiki/data"; -- > $dataDir = "/home/httpd/twiki/data"; 110c110 < $mailProgram = "/usr/sbin/sendmail -t -oi -oeq -f speechmakers/@meru.org. uk"; -- > $mailProgram = "/usr/sbin/sendmail -t -oi -oeq";
use strict at line 27. One other thing to try is to telnet to server, cd to twiki bin dir, then type perl -c view to compile and check. This should give more detail. If not, try adding a use diagnostics line in same place, or perhaps commenting out the use strict.
Also, try the perl -c TWiki.cfg trick to see if you've introduced a syntax problem. The above diff seems to include duplicate lines.
-- RichardDonkin - 06 Mar 2003
Hmmm.
perl -c TWiki.cfg gives: "No #! line at TWiki.cfg line 1." but I can't see that error in the file.
perl -c view gives: "Too late for "-T" option at view line 1." ...
Does this mean anything to anyone?! I'm not quite sure what you mean by the 'use diagnostics'/strict comments...
Cheers!
-- SimonJudge - 01 Apr 2003
You'll need perl -cT view for view and other script that have the -T switch for TaintChecking.
'use diagnostics;' is just a line you can put in for extra detail near start, where other 'use' commands are. Note the semicolon.
Also try putting a '#' character in front of the use strict line. It's hard to see why this is happening, have you got a testenv link that works?
-- RichardDonkin - 01 Apr 2003
'perl -cT view' gives the same errors, as does 'use diagnostics'. Commenting out 'use strict' gets rid of the BEGIN line (see errors below).
Testenv: running this gives the error below... i'm not having much luck here! I've chmoded it to make it accessible: www.meru.org.uk/twiki/bin/
BEGIN not safe after errors--compilation aborted at view line 27.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
[Wed Apr 2 10:57:57 2003] view: BEGIN not safe after errors--compilation aborted at view line 27.view had compilation errors.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
[Wed Apr 2 11:04:02 2003] view: view had compilation errors.use diagnostics as mentioned may help things but is version dependent, 5.6 or higher I think.
You are using a rather old version of TWiki - since it's not installed properly yet, you would save time by using the Feb 2003 release, which may fix this problem.
I tried your testenv and got an internal server error - you need to get this fixed first, probably an Apache setup problem so try the CGI help in TWikiDebugging (linked from SupportGuidelines). Testenv will run under almost any CGI setup and provide good diagnostics, so if it doesn't work that is the thing to fix first. Upgrading your TWiki will include the latest testenv which has better diagnostics.
Try commenting out the line in testenv that calls TWiki.cfg - some things will break but if this makes perl -cT work that indicates TWiki.cfg is a problem.
Also, try not using the '@' in the strings in TWiki.cfg shown above - @ introduces an array variable within a double quoted string, so it's best avoided (or use \@ to escape this).
I've just tried perl -cT on view and testenv on Feb 2003 code and they work fine, so if you upgrade and that command doesn't work after the do "TWiki.cfg" is commented out, it indicates a Perl problem rather than Apache.
-- RichardDonkin - 03 Apr 2003
Success! We've worked it out (thanks to my friendly SysAdmin mate):
[root@www lib]# diff -c TWiki.cfg TWiki.pl *** TWiki.cfg Mon Apr 7 18:26:30 2003 --- TWiki.pl Mon Apr 7 18:23:18 2003 *************** *** 107,113 **** $safeEnvPath = "/bin:/usr/bin"; # Mail program used in case Net::SMTP is not installed. # See also SMPTMAILHOST in TWikiPreferences. ! $mailProgram = "/usr/sbin/sendmail -t -oi -oeq -f speechmakers\@meru.org.uk"; # Prevent spambots from grabing addresses, default "". # I.e. set to "NOSPAM" to get "user@somewhereNOSPAM.com" $noSpamPadding = ""; --- 107,113 ---- $safeEnvPath = "/bin:/usr/bin"; # Mail program used in case Net::SMTP is not installed. # See also SMPTMAILHOST in TWikiPreferences. ! $mailProgram = "/usr/sbin/sendmail -t -oi -oeq -f speechmakers/@meru.org.uk"; # Prevent spambots from grabing addresses, default "". # I.e. set to "NOSPAM" to get "user@somewhereNOSPAM.com" $noSpamPadding = "";Note the sense of the "\" must be backslash when escaping the "@" sign (or indeed any other escape). What is weird is that the Twiki.cfg compiles fine, but not when included from another script - stupid. So, it was the "@" (and later the wrong type of "\" escaping the "@") on line 110 (the speechmakers email). Thanks a lot for your help! I will now check if WebNotify works, the whole reason that I started fiddling! Simon -- SimonJudge - 08 Apr 2003 Glad this is all working at last - the original "/" character was just another character, not a backslash, so it had no effect on the .cfg file. The reason that the code compiled OK is that the @ is interpreted at run time, which is what happens when it's included from another script. So Perl is being stupid but quite logical
... Doing perl -e "do 'TWiki.cfg'" would probably have exposed this issue.
Really it would be best if all the TWiki.cfg settings used single quotes as far as possible, which would avoid this. Anyone feel like doing a patch?
A quick example of why Perl variable interpolation is handy:
@a = ( 'foo', 'bar' ); print @a . "\n"; print "@a\n";The output of this is:
2 foo barFirst print statement just prints out size of array, which is not very useful. Array interpolation prints out the actual contents. See PerlTips for more about Perl, aka the Swiss Army Chainsaw
-- RichardDonkin - 10 Apr 2003