This question about Using an extension: Needs followup in Tasks
FastCGIEngineContrib fails with Foswiki Windows Installer
We've been using TWiki 4.11 for a few years.
I have the opportunity to re-launch this and gain wider acceptance. One partial barrier is performance which is why I'm looking at
FoswikiStandAlone and
FastCGIEngineContrib.
Installation of Foswiki on my own Win XP machine went smoothly. A number of extensions were also pretty straightforward, especially as this is now a just button in configure. Minor problems I fixed myself (it's not obvious that "Program Files" will not work in program path names).
However, the
FastCGIEngineContrib is not proving to be so straightforward.
After fixing some errors I have been able to get to the point where configure works, but not any other script. The error suggests that apache is looking in the the apache directory structure for favicon.ico rather than within the foswiki directory structure. I find this odd as the changes to Foswiki.conf between CGI and
FastCGI would not hint at such a thing.
My steps so far:
- Use Foswiki windows installer - OK
- Install our usual Plugins - tested and OK
- Install DirectedGraphPlugin - tested and OK
- Via configure, install FastCGIEngineContrib - OK
- Download fast_cgid from here: http://www.apachelounge.com/download/mods/mod_fcgid-2.2b-w32.zip
- Copied the .so file into apache modules directory
- Updated the apache httpd.conf file to add
LoadModule fcgid_module modules/mod_fcgid.so
- Restarted apache - OK
- I had missed VC8 support library - not had chance to test yet but looks important
- Tested and no dice - still not working
- Foswiki worked as expected - OK
- Updates Foswiki.conf using documentation as a guide - see my best attempt below.
- Restarted apache - OK
- configure OK
- Internal server error 500 from view script (did not try others), see apache log below
I have since updated Foswiki.conf to allow view as CGI, and indeed I can now configure and view topics. However, as soon as I click on edit, I get the same problem. This strongly focuses me on my FastCGI set-up as faulty.
However, this is stretching my level of knowledge to know what to do next:
- Where else can I look for clues?
- Anything else worth trying to generate more clues?
- Was this the wrong mod_fcgid to install?
- Is my Foswiki.conf file missing some key lines?
Foswiki.Conf
# ScriptAlias /foswiki/bin/view "C:/PROGRA~1/Foswiki/Foswiki/bin/foswiki.fcgi"
ScriptAlias /foswiki/bin/configure "C:/PROGRA~1/Foswiki/Foswiki/bin/configure"
ScriptAlias /foswiki/bin "C:/PROGRA~1/Foswiki/Foswiki/bin/foswiki.fcgi"
Alias /foswiki/ "C:/PROGRA~1/Foswiki/Foswiki/"
#rewrite url's for some of the less useful Foswiki url's
RewriteEngine on
RewriteRule ^/foswiki$ /foswiki/bin/view [R]
RewriteRule ^/foswiki/$ /foswiki/bin/view [R]
<Directory "C:/PROGRA~1/Foswiki/Foswiki/bin">
AllowOverride All
Options ExecCGI
<Files configure>
SetHandler cgi-script
</Files>
<Files foswiki.fcgi>
SetHandler fcgid-script
</Files>
# SetHandler cgi-script
Allow From All
# Password file for configure users (windows apache uses crypt, foswiki is using md5 for portability)
AuthUserFile "C:/PROGRA~1/Foswiki/Foswiki/configure.htpasswd"
AuthName 'Enter your WikiName: (First name and last name, no space, no dots, capitalized, e.g. JohnSmith). Cancel to register if you do not have one.'
AuthType Basic
<FilesMatch "^configure.*">
SetHandler cgi-script
Require user admin
</FilesMatch>
</Directory>
<Directory "C:/PROGRA~1/Foswiki/Foswiki/pub/">
AllowOverride All
Allow From All
#for TWikiCompatibility - or even to make 'attachment not found's more user friendly
ErrorDocument 404 /foswiki/bin/viewfile
</Directory>
Apache Error Log
[Sat Jun 13 22:46:11 2009] [notice] Child 2460: Starting thread to listen on port 80.
[Sat Jun 13 22:46:18 2009] [warn] (OS 109)The pipe has been ended. : mod_fcgid: get overlap result error
[Sat Jun 13 22:46:18 2009] [error] [client 24.132.179.154] Premature end of script headers: foswiki.fcgi
[Sat Jun 13 22:46:18 2009] [error] [client 24.132.179.154] File does not exist: C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/favicon.ico, referer: http://jules/foswiki/bin/view/Main/WebHome
Document Root
I noticed that
DocumentRoot in httpd.conf is pointing to
C:/Program Files/Apache Software Foundation/Apache2.2/htdocs
which surprises me. I've tried changing this to
DocumentRoot "C:/Program Files/Foswiki/Foswiki"
and I can still view (CGI) files, of course edit fails but with a different error as below.
Apache Error Log Mk II
[Thu Jun 18 10:13:55 2009] [error] [client 24.132.179.154] client denied by server configuration: C:/Program Files/Foswiki/Foswiki/edit, referer: http://jules/foswiki/bin/view/System/AnApplicationWithWikiForm
[Thu Jun 18 10:13:55 2009] [warn] (OS 109)The pipe has been ended. : mod_fcgid: get overlap result error
[Thu Jun 18 10:13:55 2009] [error] [client 24.132.179.154] Premature end of script headers: foswiki.fcgi, referer: http://jules/foswiki/bin/view/System/AnApplicationWithWikiForm
[Thu Jun 18 10:14:48 2009] [error] [client 24.132.179.154] client denied by server configuration: C:/Program Files/Foswiki/Foswiki/System, referer: http://jules/foswiki/bin/view/System/WebHome
Document Allow All
I added this to foswiki.conf
<Directory "C:/PROGRA~1/Foswiki/Foswiki">
Allow From All
</Directory>
Which still fails but the error log has only two lines as below
Apache Error Log Mk III
[Thu Jun 18 10:37:00 2009] [warn] (OS 109)The pipe has been ended. : mod_fcgid: get overlap result error
[Thu Jun 18 10:37:00 2009] [error] [client 24.132.179.154] Premature end of script headers: foswiki.fcgi, referer: http://jules/foswiki/bin/view/System/WebHome
--
JulianLevens - 13 Jun 2009
Hi Julian,
Thanks for your
rich report!
I had the same problem using
mod_fcgid
on Win2k3, but everything went fine with
www.fastcgi.com implementation. Also, replace
ScriptAlias
by
Alias
. Try the settings suggested by the
Apache config generator.
--
GilmarSantosJr - 22 Jun 2009
Hi Gilmar,
Thanks for the response. However, ...
I've now used the ApacheConfigGenerator and I get the same results as the Mk III log above. I noticed your dll reference an added this to the apache bin directory and this made no difference. Ok, some questions:
- is the
so
fast_cgid required? (from http://www.apachelounge.com/download/mods/mod_fcgid-2.2b-w32.zip)
- is the
dll
also required? If so, is placing this is apache/bin correct?
- do I need to explicitly load the
dll
someway (apache config) or will the so
do that dynamically?
- document root in main httpd.conf, is this correctly let pointing to within Apache folder and not my fowsiki folder?
- I changed this to and fro trying to eliminate the
favicon.ico
file not being found - it certainly had an impact
- Why and where is foswiki trying to access favico.ico?
- Based on the error logs it would appear to be a reference to PUBURL/
favicon.ico
directly and not via pub/system
--
JulianLevens - 25 Jun 2009
Another update:
Borrowed a simple script which I called echo.pl in my foswiki bin as follows:
#!c:\strawberry\perl\bin\perl.exe
use FCGI;
$cnt = 0;
while (FCGI::accept() >= 0)
{
print ("Content-type: text/html\r\n\r\n");
print ("<head>\n<title>FastCGI Demo Page (perl)</title>\n</head>\n");
print ("<h1>FastCGI Demo Page (perl)</h1>\n");
print ("This is coming from a FastCGI server.\n<BR>\n");
print ("Running on <EM>$ENV{USER}</EM> to <EM>$ENV{REMOTE_HOST}</EM>\n<BR>\n");
$cnt++;
print ("This is connection number $cnt\n");
}
This also failed initially with 'premature end of script headers'. However it also gave me:
- Can't locate FCGI.pm in @INC
This could have been that the Foswiki code creates a different @INC that would deal with this. Or, I had just assumed that the automatic installation via configure would have dealt with this. After searching the Foswiki and cpan directories, it was not found. So, I used the cpan client and installed FCGI. Volia the simple script above works. Alas, not foswiki, I also installed the other missing dependencies Getopt::Long and Pod::Usage but that made no difference.
UPDATE: Checking my set-up carefully, I found that the script was running CGI, and I have
not been able to run this simple script using FCGI and hence prove that mod_fcgid et al is working. What else could be wrong that's stopping Foswiki running?
Thanks again
--
JulianLevens - 26 Jun 2009
As I wrote in
Item1315,
mod_fcgid
and
mod_fastcgi
don't seem to work on Windows XP, since they depend on Apache's
libhttpd.dll
, that depends on
wer.dll
and
ieshims.dll
, that are not available on XP.
If you can, please test on 2k3 or 2k8.
--
GilmarSantosJr - 18 Aug 2009
After a some more research, I suspect that maybe it can be some permission issue (maybe apache user doesn't have permission to create named pipes). I'll test it tonight and post results.
--
GilmarSantosJr - 18 Aug 2009
I ran Apache with
Administrator
user and it didn't work. Then, I tried httpd binaries from
Apache Lounge and I had the same result. I also tried strawberry perl and activestate perl. I give up running fastcgi on Windows XP (SP3). I'll test on 2k3 and XP SP2 (when I have enough time). On success I'll add to documentation that Windows XP SP3 is not supported and on failure I'll add to documentation that
Windows is not supported. I simply don't have time to spend on such a bad operating system. Sorry.
--
GilmarSantosJr - 18 Aug 2009
Thanks for your extra work on this. I've not given up, I tried mod_fastcgi rather than mod_fcgid, which seems to get a little further, my apache logs at least reports fastcgi trying to do something. The perl still fails though. I raised queries on Apache Lounge after all my first task is to get fastcgi (any flavour) perl on Win XP Apache working, and that's non-foswiki. When I've solved that problem, I'll report back and then get foswiki up and running. The plan is to start putting together a Win 2003 server box beginning next month – that may prove to be easier.
Some of the guys on Apache Lounge are in my part of the world, so I may even arrange something face-to-face to really get to the bottom of this.
--
JulianLevens - 03 Sep 2009
I'm afraid I'm having the exact same issues getting mod_fcgid to run with Strawberryperl for the otrs.org project. If you'd make any progress I'd be really interested, and I will share any progress I make with you!
--
MikeB - 04 Sep 2009
Mike, I now have mod_fastcgi working (not fcgid alas) check out comments I made here:
Tasks.Item1315
--
JulianLevens - 07 Sep 2009