Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Custom module is present but not read by Apache (?)

by Anonymous Monk
on Dec 10, 2019 at 12:31 UTC ( #11109909=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I am trying to migrate a server that uses cgi-bin and I am running into problems, because a "use" statement does not see the modules that it is trying to access. More specifically: Apache log error
AH01215: Can't locate Error.pm in @INC (@INC contains: /srv/www/Direct +/perl-lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/pe +rl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/sh +are/perl5 .
However:
/srv/www/Direct/perl-lib/Portal
give me:
ConfigError.pm DataIntegrityError.pm Error.pm JSTypeError.pm Page.pm SessionExpiredError.pm TypeError.pm DatabaseError.pm DebugError.pm FileSizeError.pm LockError.pm PermissionError.pm SystemError.pm
so, Error.pm exists! Furthermore, the login page that is producing the error has:
use lib '/srv/www/Direct/perl-lib'; use Portal::Page; use Portal::Error; use Portal::PermissionError; use Portal::DatabaseError; use Portal::SessionExpiredError; use DirectWeb::Database; use DirectWeb::Authenticator; use Error qw(:try); use CGI; use CGI::Cookie; use Log::Handler; use URI::Escape;
which, in my mind, means that the custom lib folder is declared explicitly, but @INC does not see it (?) Am I doing something wrong here?

Replies are listed 'Best First'.
Re: Custom module is present but not read by Apache (?)
by tobyink (Canon) on Dec 10, 2019 at 13:01 UTC

    Adding to what's been said, the missing module is probably the Error.pm module from CPAN. It may have been installed via apt/yum/whatever-other-package-manager-you're-using, in which case it'll be in a system path somewhere, not living with your custom modules.

Re: Custom module is present but not read by Apache (?)
by Corion (Pope) on Dec 10, 2019 at 12:35 UTC

    The file Error.pm lives in /srv/www/Direct/perl-lib/Portal, so the first line of that file will likely be:

    package Portal::Error;

    But the line that is problematic is use Error;. Maybe this is because there is no file Error.pm in @INC. Have you looked through the directories listed in @INC to see whether there is a file Error.pm? Maybe that line references Error.pm, but if so, that module is not installed.

      Yes, that stroke me also as weird. But, given that I "only" need to migrate this website, and I just took its files from the other location, wouldn't this be problematic for the current installation too? It seems to work without a problem there.. I am wondering if there is some setting that I have not done appropriately, my vhost conf file looks like this:
      <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname a +nd port that # the server uses to identify itself. This is used when creati +ng # redirection URLs. In the context of virtual hosts, the Serve +rName # specifies what hostname must appear in the request's Host: h +eader to # match this virtual host. For the default virtual host (this +file) this # value is not decisive as it is used as a last resort host re +gardless. # However, you must set it for any further virtual host explic +itly. #ServerName www.example.com ServerAdmin webmaster@example.com ServerName xxx.xxx.xx.xx DocumentRoot /srv/www/Direct/htdocs/ # Available loglevels: trace8, ..., trace1, debug, info, notic +e, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn #ErrorLog ${APACHE_LOG_DIR}/error.log #CustomLog ${APACHE_LOG_DIR}/access.log combined ErrorLog /srv/www/Direct/error_directwebdemo.log ScriptAlias "/cgi-bin/" "/srv/www/Direct/cgi-bin/" <Directory "/srv/www/Direct/cgi-bin"> AllowOverride None Options +ExecCGI -Includes Order allow,deny Allow from all </Directory> # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For exa +mple the # following line enables the CGI configuration for this host o +nly # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
      For Centos with Apache 2.4.

        Since a CGI script is merely a normal program that has some expectations on its input and output, you can simply run the program and look if (and what) errors get printed.

        If the program works on the old machine, look at the contents of @INC on the old machine. Somewhere there is Error.pm, while it is not available on the new machine.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11109909]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2020-08-10 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (56 votes). Check out past polls.

    Notices?