Sunday, June 10, 2018

linux - perl application won't start in apache when running as a service



I have installed Netdisco, which is a perl based network discovery tool




When I run httpd from a terminal prompt as root, it works fine.



When I try and start Apache as a service (service httpd start), I get the following error(s):



Starting httpd: [Mon Apr 23 19:45:48 2012] [warn] module perl_module is already loaded, skipping
[Mon Apr 23 19:45:48 2012] [warn] module apreq_module is already loaded, skipping
Syntax error on line 22 of /etc/httpd/conf/netdisco_apache.conf:
Can't locate netdisco.pm in @INC (@INC contains: /usr/local/netdisco /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 . /etc/httpd) at /etc/httpd/conf/netdisco_apache.conf line 26.\nBEGIN failed--compilation aborted\t(in cleanup) Can't locate netdisco.pm in @INC (@INC contains: /usr/local/netdisco /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 . /etc/httpd) at /etc/httpd/conf/netdisco_apache.conf line 26.\nBEGIN failed--compilation aborted at /etc/httpd/conf/netdisco_apache.conf line 26.\n



I tried adding the apache user to the netdisco group netdisco, and got the same result.



netdisco.pm is definitely in the first folder in @INC (/usr/local/netdisco), and the netdisco user / group owns that folder and all files, including netdisco.pm



Why won't it start?


Answer



Make sure that apache user has execute access to the /usr/local/netdisco folder and read access for the /usr/local/netdisco/netdisco.pm file.



You can also strace the startup of apache to find which files is trying to access. If those files exists it is a permission problem. Besides the Unix permissions you have to check the SELinux configuration.



No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...