Installation

Installing Webwork 2.12 on CentOS 7: Apache HTTP server failed to start

Re: Installing Webwork 2.12 on CentOS 7: Apache HTTP server failed to start

by Danny Glin -
Number of replies: 0
I totally forgot that I had the same issue when I moved to CentOS 7.

For some reason CentOS 7 adds some configuration so that the root user has its own perl environment. This means that any packages that you install using CPAN are only available to the root user (as you discovered). This is a problem because apache runs as a different user, so it won't see these perl packages.

Luckily the fix is easy (once you figure out what's causing the problem):

Edit root's .bashrc file. Somewhere near the end there will be some lines about perl. Comment these out, so it looks something like this:

#PATH="/root/perl5/bin${PATH:+:${PATH}}"; export PATH;
#PERL5LIB="/root/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
#PERL_LOCAL_LIB_ROOT="/root/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
#PERL_MB_OPT="--install_base \"/root/perl5\""; export PERL_MB_OPT;
#PERL_MM_OPT="INSTALL_BASE=/root/perl5"; export PERL_MM_OPT;

Once you've saved the file, log out, and log back in as root (to make sure you have a fresh session), then install the necessary modules using CPAN. Now they should be installed in the proper system location.

As an aside, running check_modules.pl as the apache user may give you a different result than running it as root. To see if apache has access to the necessary perl modules, you could try running:
sudo -u apache check_modules.pl
(though I don't know if this is a true test, as it may not load the proper environment variables).