Index: /main/trunk/greenstone2/common-src/cgi-bin/build-server.pl
===================================================================
--- /main/trunk/greenstone2/common-src/cgi-bin/build-server.pl	(revision 33010)
+++ /main/trunk/greenstone2/common-src/cgi-bin/build-server.pl	(revision 33011)
@@ -12,4 +12,22 @@
     Win32::SetChildShowWindow(0)
 	if defined &Win32::SetChildShowWindow;
+    
+    # On Ubuntu 18.04, gsdlCGI.pm can't be found as the cgi folder is not among @INC paths.
+    # Ensure gsdlCGI.pm is available in @INC by adding the cgi folder to it.
+    # For GS2:
+    my $gsdl_cgi_path = $ENV{'GSDLHOME'} . "/cgi-bin";
+    # For GS3:
+    $gsdl_cgi_path = $ENV{'GSDL3HOME'} . "/WEB-INF" . "/cgi" if defined $ENV{'GSDL3HOME'};
+
+    my $found_cgi_path = 0;
+    foreach my $inc_path (@INC) {
+        if($inc_path eq $gsdl_cgi_path) {
+                $found_cgi_path = 1;
+                last;
+        }
+    }
+    if(!$found_cgi_path) {
+      unshift (@INC, $gsdl_cgi_path);
+    }
 }
 
Index: /main/trunk/greenstone2/common-src/cgi-bin/document-extract.pl
===================================================================
--- /main/trunk/greenstone2/common-src/cgi-bin/document-extract.pl	(revision 33010)
+++ /main/trunk/greenstone2/common-src/cgi-bin/document-extract.pl	(revision 33011)
@@ -11,5 +11,22 @@
     Win32::SetChildShowWindow(0)
 	if defined &Win32::SetChildShowWindow;
+    
+    # On Ubuntu 18.04, gsdlCGI.pm can't be found as the cgi folder is not among @INC paths.
+    # Ensure gsdlCGI.pm is available in @INC by adding the cgi folder to it.
+    # For GS2:
+    my $gsdl_cgi_path = $ENV{'GSDLHOME'} . "/cgi-bin";
+    # For GS3:
+    $gsdl_cgi_path = $ENV{'GSDL3HOME'} . "/WEB-INF" . "/cgi" if defined $ENV{'GSDL3HOME'};
 
+    my $found_cgi_path = 0;
+    foreach my $inc_path (@INC) {
+        if($inc_path eq $gsdl_cgi_path) {
+                $found_cgi_path = 1;
+                last;
+        }
+    }
+    if(!$found_cgi_path) {
+      unshift (@INC, $gsdl_cgi_path);
+    }
 }
 
Index: /main/trunk/greenstone2/common-src/cgi-bin/experimental-ocr-server.pl
===================================================================
--- /main/trunk/greenstone2/common-src/cgi-bin/experimental-ocr-server.pl	(revision 33010)
+++ /main/trunk/greenstone2/common-src/cgi-bin/experimental-ocr-server.pl	(revision 33011)
@@ -14,5 +14,22 @@
     Win32::SetChildShowWindow(0)
 	if defined &Win32::SetChildShowWindow;
+    
+    # On Ubuntu 18.04, gsdlCGI.pm can't be found as the cgi folder is not among @INC paths.
+    # Ensure gsdlCGI.pm is available in @INC by adding the cgi folder to it.
+    # For GS2:
+    my $gsdl_cgi_path = $ENV{'GSDLHOME'} . "/cgi-bin";
+    # For GS3:
+    $gsdl_cgi_path = $ENV{'GSDL3HOME'} . "/WEB-INF" . "/cgi" if defined $ENV{'GSDL3HOME'};
 
+    my $found_cgi_path = 0;
+    foreach my $inc_path (@INC) {
+        if($inc_path eq $gsdl_cgi_path) {
+                $found_cgi_path = 1;
+                last;
+        }
+    }
+    if(!$found_cgi_path) {
+      unshift (@INC, $gsdl_cgi_path);
+    }
 }
 
Index: /main/trunk/greenstone2/common-src/cgi-bin/explode-server.pl
===================================================================
--- /main/trunk/greenstone2/common-src/cgi-bin/explode-server.pl	(revision 33010)
+++ /main/trunk/greenstone2/common-src/cgi-bin/explode-server.pl	(revision 33011)
@@ -11,4 +11,22 @@
     Win32::SetChildShowWindow(0)
 	if defined &Win32::SetChildShowWindow;
+
+    # On Ubuntu 18.04, gsdlCGI.pm can't be found as the cgi folder is not among @INC paths.
+    # Ensure gsdlCGI.pm is available in @INC by adding the cgi folder to it.
+    # For GS2:
+    my $gsdl_cgi_path = $ENV{'GSDLHOME'} . "/cgi-bin";
+    # For GS3:
+    $gsdl_cgi_path = $ENV{'GSDL3HOME'} . "/WEB-INF" . "/cgi" if defined $ENV{'GSDL3HOME'};
+
+    my $found_cgi_path = 0;
+    foreach my $inc_path (@INC) {
+        if($inc_path eq $gsdl_cgi_path) {
+                $found_cgi_path = 1;
+                last;
+        }
+    }
+    if(!$found_cgi_path) {
+      unshift (@INC, $gsdl_cgi_path);
+    }
 }
 
Index: /main/trunk/greenstone2/common-src/cgi-bin/gliserver.pl
===================================================================
--- /main/trunk/greenstone2/common-src/cgi-bin/gliserver.pl	(revision 33010)
+++ /main/trunk/greenstone2/common-src/cgi-bin/gliserver.pl	(revision 33011)
@@ -14,4 +14,21 @@
 	if defined &Win32::SetChildShowWindow;
 
+    # On Ubuntu 18.04, gsdlCGI.pm can't be found as the cgi folder is not among @INC paths.
+    # Ensure gsdlCGI.pm is available in @INC by adding the cgi folder to it.
+    # For GS2:
+    my $gsdl_cgi_path = $ENV{'GSDLHOME'} . "/cgi-bin";
+    # For GS3:
+    $gsdl_cgi_path = $ENV{'GSDL3HOME'} . "/WEB-INF" . "/cgi" if defined $ENV{'GSDL3HOME'};
+
+    my $found_cgi_path = 0;
+    foreach my $inc_path (@INC) {
+        if($inc_path eq $gsdl_cgi_path) {
+                $found_cgi_path = 1;
+                last;
+        }
+    }
+    if(!$found_cgi_path) {
+      unshift (@INC, $gsdl_cgi_path);
+    }
 }
 
Index: /main/trunk/greenstone2/common-src/cgi-bin/image-server.pl
===================================================================
--- /main/trunk/greenstone2/common-src/cgi-bin/image-server.pl	(revision 33010)
+++ /main/trunk/greenstone2/common-src/cgi-bin/image-server.pl	(revision 33011)
@@ -4,4 +4,25 @@
 
 use strict;
+
+
+BEGIN {
+    # On Ubuntu 18.04, gsdlCGI.pm can't be found as the cgi folder is not among @INC paths.
+    # Ensure gsdlCGI.pm is available in @INC by adding the cgi folder to it.
+    # For GS2:
+    my $gsdl_cgi_path = $ENV{'GSDLHOME'} . "/cgi-bin";
+    # For GS3:
+    $gsdl_cgi_path = $ENV{'GSDL3HOME'} . "/WEB-INF" . "/cgi" if defined $ENV{'GSDL3HOME'};
+
+    my $found_cgi_path = 0;
+    foreach my $inc_path (@INC) {
+        if($inc_path eq $gsdl_cgi_path) {
+                $found_cgi_path = 1;
+                last;
+        }
+    }
+    if(!$found_cgi_path) {
+      unshift (@INC, $gsdl_cgi_path);
+    }
+}
 
 
Index: /main/trunk/greenstone2/common-src/cgi-bin/index-server.pl
===================================================================
--- /main/trunk/greenstone2/common-src/cgi-bin/index-server.pl	(revision 33010)
+++ /main/trunk/greenstone2/common-src/cgi-bin/index-server.pl	(revision 33011)
@@ -11,4 +11,22 @@
     Win32::SetChildShowWindow(0)
 	if defined &Win32::SetChildShowWindow;
+
+    # On Ubuntu 18.04, gsdlCGI.pm can't be found as the cgi folder is not among @INC paths.
+    # Ensure gsdlCGI.pm is available in @INC by adding the cgi folder to it.
+    # For GS2:
+    my $gsdl_cgi_path = $ENV{'GSDLHOME'} . "/cgi-bin";
+    # For GS3:
+    $gsdl_cgi_path = $ENV{'GSDL3HOME'} . "/WEB-INF" . "/cgi" if defined $ENV{'GSDL3HOME'};
+
+    my $found_cgi_path = 0;
+    foreach my $inc_path (@INC) {
+        if($inc_path eq $gsdl_cgi_path) {
+                $found_cgi_path = 1;
+                last;
+        }
+    }
+    if(!$found_cgi_path) {
+      unshift (@INC, $gsdl_cgi_path);
+    }
 }
 
Index: /main/trunk/greenstone2/common-src/cgi-bin/metadata-server.pl
===================================================================
--- /main/trunk/greenstone2/common-src/cgi-bin/metadata-server.pl	(revision 33010)
+++ /main/trunk/greenstone2/common-src/cgi-bin/metadata-server.pl	(revision 33011)
@@ -11,5 +11,22 @@
     Win32::SetChildShowWindow(0)
 	if defined &Win32::SetChildShowWindow;
+    
+    # On Ubuntu 18.04, gsdlCGI.pm can't be found as the cgi folder is not among @INC paths.
+    # Ensure gsdlCGI.pm is available in @INC by adding the cgi folder to it.
+    # For GS2:
+    my $gsdl_cgi_path = $ENV{'GSDLHOME'} . "/cgi-bin";
+    # For GS3:
+    $gsdl_cgi_path = $ENV{'GSDL3HOME'} . "/WEB-INF" . "/cgi" if defined $ENV{'GSDL3HOME'};
 
+    my $found_cgi_path = 0;
+    foreach my $inc_path (@INC) {
+        if($inc_path eq $gsdl_cgi_path) {
+                $found_cgi_path = 1;
+                last;
+        }
+    }
+    if(!$found_cgi_path) {
+      unshift (@INC, $gsdl_cgi_path);
+    }
 }
 
Index: /main/trunk/greenstone2/common-src/cgi-bin/talkback-progressbar.pl
===================================================================
--- /main/trunk/greenstone2/common-src/cgi-bin/talkback-progressbar.pl	(revision 33010)
+++ /main/trunk/greenstone2/common-src/cgi-bin/talkback-progressbar.pl	(revision 33011)
@@ -13,7 +13,25 @@
 
 BEGIN {
+
+    # On Ubuntu 18.04, gsdlCGI.pm can't be found as the cgi folder is not among @INC paths.
+    # Ensure gsdlCGI.pm is available in @INC by adding the cgi folder to it.
+    # For GS2:
+    my $gsdl_cgi_path = $ENV{'GSDLHOME'} . "/cgi-bin";
+    # For GS3:
+    $gsdl_cgi_path = $ENV{'GSDL3HOME'} . "/WEB-INF" . "/cgi" if defined $ENV{'GSDL3HOME'};
+
+    my $found_cgi_path = 0;
+    foreach my $inc_path (@INC) {
+        if($inc_path eq $gsdl_cgi_path) {
+                $found_cgi_path = 1;
+                last;
+        }
+    }
+    if(!$found_cgi_path) {
+      unshift (@INC, $gsdl_cgi_path);
+    }
     
     $|=1; # Force auto-flushing for output
-
+    
     eval('require "./gsdlCGI.pm"');
     if ($@)
Index: /main/trunk/greenstone2/common-src/cgi-bin/talkback-transfer.pl
===================================================================
--- /main/trunk/greenstone2/common-src/cgi-bin/talkback-transfer.pl	(revision 33010)
+++ /main/trunk/greenstone2/common-src/cgi-bin/talkback-transfer.pl	(revision 33011)
@@ -12,4 +12,22 @@
 
 BEGIN {
+    # On Ubuntu 18.04, gsdlCGI.pm can't be found as the cgi folder is not among @INC paths.
+    # Ensure gsdlCGI.pm is available in @INC by adding the cgi folder to it.
+    # For GS2:
+    my $gsdl_cgi_path = $ENV{'GSDLHOME'} . "/cgi-bin";
+    # For GS3:
+    $gsdl_cgi_path = $ENV{'GSDL3HOME'} . "/WEB-INF" . "/cgi" if defined $ENV{'GSDL3HOME'};
+
+    my $found_cgi_path = 0;
+    foreach my $inc_path (@INC) {
+        if($inc_path eq $gsdl_cgi_path) {
+                $found_cgi_path = 1;
+                last;
+        }
+    }
+    if(!$found_cgi_path) {
+      unshift (@INC, $gsdl_cgi_path);
+    }
+    
     eval('require "./gsdlCGI.pm"');
     if ($@)
Index: /main/trunk/greenstone3/build.xml
===================================================================
--- /main/trunk/greenstone3/build.xml	(revision 33010)
+++ /main/trunk/greenstone3/build.xml	(revision 33011)
@@ -2433,5 +2433,5 @@
     <exec executable="${sudo.or.not}" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
       <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
-      <env key="GSDL3HOME" value="${basedir}"/>
+      <env key="GSDL3HOME" value="${web.home}"/>
       <env key="PATH" path="${tomcat.path}"/>
       <env key="CATALINA_OPTS" value="${catalina.opts}"/>
@@ -2446,5 +2446,5 @@
     <exec executable="${catalina.home}/bin/startup.bat" osfamily="windows" dir="${catalina.home}/bin" spawn="true">
       <env key="GSDLOS" value="windows"/>
-      <env key="GSDL3HOME" value="${basedir}"/>
+      <env key="GSDL3HOME" value="${web.home}"/>
       <env key="Path" path="${tomcat.path}"/>
       <env key="PATH" path="${tomcat.path}"/>
