Installation

WW2.16 error "Failed to initialize course environment..."

WW2.16 error "Failed to initialize course environment..."

by George Jennings -
Number of replies: 2

I have installed WW2.16 from scratch on a Ubuntu 20.04 laptop at http://localhost/webwork2.  Apache2 runs fine but when I try to open webwork I get these messages
 
"Warning messages
 
    Use of uninitialized value $globalEnvironmentFile in concatenation (.) or string at /home/gjennings/webwork/webwork2/lib/WeBWorK/CourseEnvironment.pm line 158.
 
Error messages
 
Failed to initialize course environment: Cannot read global environment file at /home/gjennings/webwork/webwork2/lib/WeBWorK.pm line 233. "
 
Regarding the first ("warning") message, CourseEnvironment.pm line 158 is the "croak" line in
 
       if (-r "$seedVars{webwork_dir}/conf/defaults.config") {
                $globalEnvironmentFile = "$seedVars{webwork_dir}/conf/defaults.config";
        } else {
                croak "Cannot read global environment file $globalEnvironmentFile";
        }
 
webwork_dir is set on this line in webwork.apace2.4-config
 
        $webwork_dir = "/home/gjennings/webwork/webwork2";
 
Regarding the second ("error") message, WeBWorK.pm line 233 is the "apache hostname" line in
 
        my $ce = eval { new WeBWorK::CourseEnvironment({
                %SeedCE,
                courseName => $displayArgs{courseID},
                # this is kind of a hack, but it's really the only sane way to get this
                # server information into the PG box
                apache_hostname => $apache_hostname,
                apache_port => $apache_port,
                apache_is_ssl => $apache_is_ssl,
                apache_root_url => $apache_root_url,
        }) };
 
The apache2ctl restart command reports this information
 
webwork.apache2-config:  WeBWorK root directory set to /home/gjennings/webwork/webwork2 in webwork2/conf/webwork.apache2-config
webwork.apache2-config:  The following locations and urls are set in webwork2/conf/site.conf
webwork.apache2-config:  PG root directory set to /home/gjennings/webwork/pg
webwork.apache2-config:  WeBWorK server userID is
webwork.apache2-config:  WeBWorK server groupID is
webwork.apache2-config:  The webwork url on this site is http://localhost/webwork2
webwork.apache2-config:  The webwork smtp server address is localhost
webwork.apache2-config:     The webwork smtp server port is
webwork.apache2-config:     The webwork smtp server protocol is 'not ssl'
WebworkSOAP::WSDL: webwork_directory set to /home/gjennings/webwork/webwork2 via $WeBWorK::Constants::WEBWORK_DIRECTORY set in webwork.apache2-config
WebworkSOAP::WSDL: rpc_url set to http://localhost/webwork2_rpc
WebworkWebservice: webwork_directory set to /home/gjennings/webwork/webwork2 via $WeBWorK::Constants::WEBWORK_DIRECTORY set in webwork.apache2-config
 
so it seems that apache knows where webwork is.  What else could be wrong?
 
Thanks in advance for any suggestions.
--George

In reply to George Jennings

Re: WW2.16 error "Failed to initialize course environment..."

by Danny Glin -

It looks like apache is unable to read the config file defaults.config.  The first thing I'd check is the permissions of the files in the WeBWorK conf directory, and make sure apache has access to them.