You are here: Foswiki>Tasks Web>Item13040 (05 Jul 2015, GeorgeClark)Edit Attach

Item13040: Foswiki 1.2 issues on Nginx

pencil
Priority: Urgent
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component: ConfigureBootstrap, FastCGIEngineContrib, PlatformNginx
Branches: master Item13010
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
Issues running 1.2, bootstrap and the new configure on Nginx / FCGI

  • For bootstrap to work, Foswiki.fcgi needs to not fail for a missing LocalSite.cfg
  • DONE $ENV{PATH} doesn't get set, and configure causes errors until SafeEnvPath is manually set
  • DONE (General Foswiki.fcgi issue - fcgi is picked up as a script suffix and generates errors

  • Email autoconfigure fails in the capture of STDERR: (See rt bug report
@@ -516,6 +516,11 @@ sub _autoconfigSMTP {
     close STDERR;
     open( my $fd2, ">/dev/null" ) or die "fd2: $!\n";
     $tlog = '';
+
+    #SMELL:  Does not work under FCGI
+    # at ../foswiki/distro/core/lib/Foswiki/Configure/Wizards/AutoConfigureEmail.pm line 302.
+    # Foswiki::Configure::Wizards::AutoConfigureEmail::__ANON__("Operation 'OPEN' not supported on FCGI::Stream handle 
+
     open( STDERR, '+>>', \$tlog ) or die "SSL logging: $!\n";

  • A second OPEN is performed around line 626. Commenting out both open statements, seems to allow the AutoConfigure to run.

  • Needs followup: Had to change htpasswd file name from relative $Foswiki::cfg{DataDir} to explicit path to get registration to enable.

-- GeorgeClark - 28 Sep 2014

I used the following patch to get Foswiki.fcgi to tolerate a missing LocalSite.cfg:

diff --git a/lib/Foswiki/Engine/FastCGI.pm b/lib/Foswiki/Engine/FastCGI.pm
index 8734ae3..ddc53f4 100644
--- a/lib/Foswiki/Engine/FastCGI.pm
+++ b/lib/Foswiki/Engine/FastCGI.pm
@@ -98,10 +98,11 @@ sub run {
     }
 
     my $localSiteCfg = $INC{'LocalSite.cfg'};
-    die "LocalSite.cfg is not loaded - Check permissions or run configure\n"
-      unless defined $localSiteCfg;
+    my $lastMTime = 0;
 
-    my $lastMTime = ( stat $localSiteCfg )[9];
+    if ( defined $localSiteCfg ) { 
+        $lastMTime = ( stat $localSiteCfg )[9];
+    }
 
     while ( $r->Accept() >= 0 ) {
         $manager && $manager->pm_pre_dispatch();
@@ -113,7 +114,7 @@ sub run {
             $this->finalize( $res, $req );
         }
 
-        my $mtime = ( stat $localSiteCfg )[9];
+        my $mtime = (defined $localSiteCfg) ? ( stat $localSiteCfg )[9] : 1;
         $maxRequests--;
         if ( $mtime > $lastMTime || $hupRecieved || $maxRequests == 0 ) {
             $r->LastCall();

-- GeorgeClark - 13 Nov 2014

Closing this ... I think the email autoconfigure issues are resolved.

-- GeorgeClark - 24 Jan 2015

Reopening due to bootstrap issues.

-- GeorgeClark - 25 Jan 2015

Michael, I've got the above fix (plus some other fixes) staged to push to the Item13010 branch. Do you want it there, or should I wait until after you merge.
  • Make Fastcgi reinit after each txn if LocalSite.cfg has not been loaded.
  • Don't die on undef'd config variables.
  • Don't grow PERL5LIB on each reinit.

-- GeorgeClark - 27 Jan 2015

The Item13010 branch has been merged back to master.

-- MichaelDaum - 29 Jan 2015
 
Topic revision: r16 - 05 Jul 2015, GeorgeClark - This page was cached on 28 Jun 2016 - 10:42.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License