When I tried accessing a website on a CentOS 7 server that I had recently set up as a web server using Apache, when I attempted to view the site, which I transferred from a CentOS 5 system, I saw the following error message in my browser.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at firstname.lastname@example.org to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Checking the httpd error log, I saw the following entries for the problem:
[Sun Nov 02 11:31:21.399775 2014] [cgi:error] [pid 18794] [client 18.104.22.168:55416] AH01215: Can't locate CGI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/jdoe/public_html/blog/blosxom line 92. [Sun Nov 02 11:31:21.399911 2014] [cgi:error] [pid 18794] [client 22.214.171.124:55416] AH01215: BEGIN failed--compilation aborted at /home/jdoe/public_html/blog/blosxom line 92. [Sun Nov 02 11:31:21.401265 2014] [cgi:error] [pid 18794] [client 126.96.36.199:55416] End of script output before headers: blosxom
When I searched the system for
CGI.pm, I found it was not
# find / -name CGI.pm -print 2>/dev/null #
The file was present on a backup from the CentOS 5 system at
Since it wasn't installed, I tried installing it.
# perl -e shell -MCPAN Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .). BEGIN failed--compilation aborted.
But that failed because
CPAN.pm wasn't installed, either.
# find /usr/lib/perl5 -name CPAN.pm -print 2>/dev/null # whereis CPAN.pm CPAN:[root@frostdragon conf]# locate CPAN.pm #
So I installed the
perl-CPAN package with
# yum install perl-CPAN
After the installation, I checked on the package and the location of CPAN.pm.
# rpm -qi perl-CPAN Name : perl-CPAN Epoch : 0 Version : 1.9800 Release : 283.el7 Architecture: noarch Install Date: Sun 02 Nov 2014 12:02:15 PM EST Group : Development/Languages Size : 762403 License : GPL+ or Artistic Signature : RSA/SHA256, Fri 04 Jul 2014 12:15:45 AM EDT, Key ID 24c6a8a7f4a80eb5 Source RPM : perl-5.16.3-283.el7.src.rpm Build Date : Tue 17 Jun 2014 01:42:20 PM EDT Build Host : worker1.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://www.perl.org/ Summary : Query, download and build perl modules from CPAN sites Description : Query, download and build perl modules from CPAN sites. # whereis CPAN.pm CPAN: /usr/share/man/man3/CPAN.3pm.gz #
I was then able to install
# perl -e shell -MCPAN CPAN.pm requires configuration, but most of it can be done automatically. If you answer 'no' below, you will enter an interactive dialog for each configuration option instead. Would you like to configure as much as possible automatically? [yes] yes <install_help> Warning: You do not have write permission for Perl library directories. To install modules, you need to configure a local Perl library directory or escalate your privileges. CPAN can help you by bootstrapping the local::lib module or by configuring itself to use 'sudo' (if available). You may also resolve this problem manually if you need to customize your setup. What approach do you want? (Choose 'local::lib', 'sudo' or 'manual') [local::lib] sudo Autoconfigured everything but 'urllist'. Now you need to choose your CPAN mirror sites. You can let me pick mirrors for you, you can select them from a list or you can enter them by hand. Would you like me to automatically choose some CPAN mirror sites for you? (This means connecting to the Internet) [yes] yes Trying to fetch a mirror list from the Internet Fetching with LWP: http://www.perl.org/CPAN/MIRRORED.BY Looking for CPAN mirrors near you (please be patient) ........................... done! New urllist http://cpan-du.viaverio.com/ http://mirror.cogentco.com/pub/CPAN/ http://httpupdate25.cpanel.net/CPAN/ Autoconfiguration complete. commit: wrote '/root/.cpan/CPAN/MyConfig.pm' You can re-run configuration any time with 'o conf init' in the CPAN shell Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v1.9800) Enter 'h' for help. cpan>
cpan prompt, I entered
Note: You need to use uppercase letters, not "cgi"
After the installation completed, I typed "exit" at the CPAN prompt. I was then able to reload the page in the browser without getting the "Internal Server" error; I did not have to restart Apache.
Perl CGI:Can't locate CGI.pm
Date: June 5, 2005
perl CPAN not installed by default
Date: February 4, 2012