Mailing List Archive

error trying to start httpd with mod_perl enabled
I’m setting up a new server to replace one that is currently running fine (I am changing the database for my app from oracle to Postgres and need to test this before doing the switchover.)

I’ve looked at the apache settings on both systems, file permissions, etc and they look the same, but httpd fails at startup with the following error:


[Thu Oct 26 16:11:46.962322 2023] [perl:error] [pid 96852:tid 96852] Can't locate /home/allwebfiles/perl/startup.pl: /home/allwebfiles/perl/startup.pl: Permission denied at (eval 2) line 1.\n
[Thu Oct 26 16:11:46.962564 2023] [perl:error] [pid 96852:tid 96852] Can't load Perl file: /home/allwebfiles/perl/startup.pl for server dhbroomscheduling4.pharmacy.arizona.edu<http://dhbroomscheduling4.pharmacy.arizona.edu>:0, exiting..

The file permissions are correct

ls -l /home/allwebfiles/perl/startup.pl
-rwxr-xr-x. 1 webworker apache 515 Oct 26 16:11 /home/allwebfiles/perl/startup.pl

The contents of startup.pl seem to be correct (the only change was the dbd line in the DBI startup.)

#!/usr/bin/perl
use lib qw(/usr/lib64/perl5 /usr/share/perl5 /usr/local/lib64/perl5 /home/allwebfiles/perl/LocalModules /usr/lib64/perl5/vendor_perl/Bundle);

use Apache::DBI;
Apache::DBI->connect_on_init ("dbi:Pg:host=redacted;port=5432", “xxxxxxx", “xxxxxxx", {
PrintError => 1, # warn() on errors
RaiseError => 0, # don't die on error
AutoCommit => 1, # commit executes immediately
}
);
use CleanCGI ();
use CGI ();
CGI->compile(':all');


use DBI ();
use Apache2;
1;


This is the correct location of perl, and all the use lib locations are correct

which perl
/usr/bin/perl


System:

cat /etc/redhat-release
Rocky Linux release 9.2 (Blue Onyx)

perl -v

This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux-thread-multi
(with 52 registered patches, see perl -V for more detail)

httpd -v
Server version: Apache/2.4.53 (Rocky Linux)
Server built: Apr 28 2023 00:00:00

(And yes mod_perl is installed )

The working system is an older distro of Rocky Linux 8.5, but otherwise all is identical, with the exceptions I”m connecy=ting to Oracle on it not Postgres.

(I can connect and query the database using a script on the command line on the new system so I know all of that works)

--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs
Re: error trying to start httpd with mod_perl enabled [ In reply to ]
In message <8B1FF73C-7C72-40D0-9E27-9D19E237AEE0@email.arizona.edu>, "Johnson, Bruce E - (bjohnson)" writes:
>I'm setting up a new server to replace one that is currently running
>fine (I am changing the database for my app from oracle to Postgres
>and need to test this before doing the switchover.)
>
>I've looked at the apache settings on both systems, file
>permissions, etc and they look the same, but httpd fails at startup
>with the following error:
>
>
>[Thu Oct 26 16:11:46.962322 2023] [perl:error] [pid 96852:tid 96852]
>Can't locate /home/allwebfiles/perl/startup.pl:
>/home/allwebfiles/perl/startup.pl: Permission denied at (eval 2)
>line 1.\n
>[Thu Oct 26 16:11:46.962564 2023] [perl:error] [pid 96852:tid 96852]
>Can't load Perl file: /home/allwebfiles/perl/startup.pl for server
>dhbroomscheduling4.pharmacy.arizona.edu<http://dhbroomscheduling4.pharmacy.arizona.edu>:0,
>exiting..
>
>The file permissions are correct
>
> ls -l /home/allwebfiles/perl/startup.pl
>-rwxr-xr-x. 1 webworker apache 515 Oct 26 16:11
>/home/allwebfiles/perl/startup.pl
>
>The contents of startup.pl seem to be correct (the only change was
>the dbd line in the DBI startup.)

Two tests come to mind that might help you debug:
# apachectl configtest
# su - webworker
$ perl -c /home/allwebfiles/perl/startup.pl

John
groenveld@acm.org
Re: [EXT]Re: error trying to start httpd with mod_perl enabled [ In reply to ]
On Oct 27, 2023, at 6:34 AM, John D Groenveld <groenveld@acm.org> wrote:


The contents of startup.pl seem to be correct (the only change was
the dbd line in the DBI startup.)

Two tests come to mind that might help you debug:
# apachectl configtest


apachectl configtest

[Fri Oct 27 08:41:49.204868 2023] [so:warn] [pid 97206:tid 97206] AH01574: module perl_module is already loaded, skipping

Syntax OK


# su - webworker
$ perl -c /home/allwebfiles/perl/startup.pl


[webworker@dhbroomscheduling4 ~]$ perl -c /home/allwebfiles/perl/startup.pl

/home/allwebfiles/perl/startup.pl syntax OK


--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs
Re: [EXT]Re: error trying to start httpd with mod_perl enabled [ In reply to ]
In message <E1DD309D-F8D0-42EC-AD3B-EFEDDE5DCFCB@arizona.edu>, "Johnson, Bruce E - (bjohnson)" writes:
>apachectl configtest
>
>[Fri Oct 27 08:41:49.204868 2023] [so:warn] [pid 97206:tid 97206] AH01574: =
>module perl_module is already loaded, skipping
>
>Syntax OK
>
>
># su - webworker
>$ perl -c /home/allwebfiles/perl/startup.pl
>
>
>[webworker@dhbroomscheduling4 ~]$ perl -c /home/allwebfiles/perl/startup.pl
>
>/home/allwebfiles/perl/startup.pl syntax OK

Maybe try an strace(1) to find the failed open(2):
# strace -f -e open httpd -X

John
groenveld@acm.org
Re: error trying to start httpd with mod_perl enabled [ In reply to ]
Rocky has SELinux on by default I think.  Could be that getting in the way ?

What does "getenforce" say ?

Andy


On 27/10/2023 13:54, Johnson, Bruce E - (bjohnson) wrote:
> I’m setting up a new server to replace one that is currently running fine (I am changing the database for my app from oracle to
> Postgres and need to test this before doing the switchover.)
>
> I’ve looked at the apache settings on both systems, file permissions, etc and they look the same, but httpd fails at startup with
> the following error:
>
>
> [Thu Oct 26 16:11:46.962322 2023] [perl:error] [pid 96852:tid 96852] Can't locate /home/allwebfiles/perl/startup.pl:
> /home/allwebfiles/perl/startup.pl: Permission denied at (eval 2) line 1.\n
> [Thu Oct 26 16:11:46.962564 2023] [perl:error] [pid 96852:tid 96852] Can't load Perl file: /home/allwebfiles/perl/startup.pl for
> server dhbroomscheduling4.pharmacy.arizona.edu <http://dhbroomscheduling4.pharmacy.arizona.edu>:0, exiting..
>
> The file permissions are correct
>
>  ls -l /home/allwebfiles/perl/startup.pl
> -rwxr-xr-x. 1 webworker apache 515 Oct 26 16:11 /home/allwebfiles/perl/startup.pl
>
> The contents of startup.pl seem to be correct (the only change was the dbd line in the DBI startup.)
>
> #!/usr/bin/perl
> use lib qw(/usr/lib64/perl5 /usr/share/perl5 /usr/local/lib64/perl5 /home/allwebfiles/perl/LocalModules
> /usr/lib64/perl5/vendor_perl/Bundle);
>
> use Apache::DBI;
> Apache::DBI->connect_on_init ("dbi:Pg:host=redacted;port=5432", “xxxxxxx", “xxxxxxx", {
>     PrintError => 1, # warn() on errors
>     RaiseError => 0, # don't die on error
>     AutoCommit => 1, # commit executes immediately
>    }
>   );
> use CleanCGI ();
> use CGI ();
> CGI->compile(':all');
>
>
> use DBI ();
> use Apache2;
> 1;
>
>
> This is the correct location of perl, and all the use lib locations are correct
>
> which perl
> /usr/bin/perl
>
>
> System:
>
> cat /etc/redhat-release
> Rocky Linux release 9.2 (Blue Onyx)
>
>  perl -v
>
> This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux-thread-multi
> (with 52 registered patches, see perl -V for more detail)
>
> httpd -v
> Server version: Apache/2.4.53 (Rocky Linux)
> Server built:   Apr 28 2023 00:00:00
>
> (And yes mod_perl is installed )
>
> The working system is an older distro of Rocky Linux 8.5, but otherwise all is identical, with the exceptions I”m connecy=ting to
> Oracle on it not Postgres.
>
> (I can connect and query the database using a script on the command line on the new system so I know all of that works)
>
> --
> Bruce Johnson
> University of Arizona
> College of Pharmacy
> Information Technology Group
>
> Institutions do not have opinions, merely customs
>

--
Andy Osborne - Technical Director
Conscious Solutions, Royal London Buildings, Baldwin St. Bristol BS1 1PN
UK Co. Reg No. 4966976 VAT No. 826 2638 21https://www.conscious.co.uk/
tel:01173250200 ddi:01173250204https://www.linkedin.com/in/andyosborne
Re: [EXT]Re: error trying to start httpd with mod_perl enabled [ In reply to ]
Yep, that was it.

I thought it had been set to disabled but it was not.

On Oct 27, 2023, at 9:31 AM, Andy Osborne <andy@beerwolf.net> wrote:


External Email

Rocky has SELinux on by default I think. Could be that getting in the way ?

What does "getenforce" say ?

Andy


On 27/10/2023 13:54, Johnson, Bruce E - (bjohnson) wrote:
I’m setting up a new server to replace one that is currently running fine (I am changing the database for my app from oracle to Postgres and need to test this before doing the switchover.)

I’ve looked at the apache settings on both systems, file permissions, etc and they look the same, but httpd fails at startup with the following error:


[Thu Oct 26 16:11:46.962322 2023] [perl:error] [pid 96852:tid 96852] Can't locate /home/allwebfiles/perl/startup.pl: /home/allwebfiles/perl/startup.pl: Permission denied at (eval 2) line 1.\n
[Thu Oct 26 16:11:46.962564 2023] [perl:error] [pid 96852:tid 96852] Can't load Perl file: /home/allwebfiles/perl/startup.pl for server dhbroomscheduling4.pharmacy.arizona.edu<http://dhbroomscheduling4.pharmacy.arizona.edu/>:0, exiting..

The file permissions are correct

ls -l /home/allwebfiles/perl/startup.pl
-rwxr-xr-x. 1 webworker apache 515 Oct 26 16:11 /home/allwebfiles/perl/startup.pl

The contents of startup.pl seem to be correct (the only change was the dbd line in the DBI startup.)

#!/usr/bin/perl
use lib qw(/usr/lib64/perl5 /usr/share/perl5 /usr/local/lib64/perl5 /home/allwebfiles/perl/LocalModules /usr/lib64/perl5/vendor_perl/Bundle);

use Apache::DBI;
Apache::DBI->connect_on_init ("dbi:Pg:host=redacted;port=5432", “xxxxxxx", “xxxxxxx", {
PrintError => 1, # warn() on errors
RaiseError => 0, # don't die on error
AutoCommit => 1, # commit executes immediately
}
);
use CleanCGI ();
use CGI ();
CGI->compile(':all');


use DBI ();
use Apache2;
1;


This is the correct location of perl, and all the use lib locations are correct

which perl
/usr/bin/perl


System:

cat /etc/redhat-release
Rocky Linux release 9.2 (Blue Onyx)

perl -v

This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux-thread-multi
(with 52 registered patches, see perl -V for more detail)

httpd -v
Server version: Apache/2.4.53 (Rocky Linux)
Server built: Apr 28 2023 00:00:00

(And yes mod_perl is installed )

The working system is an older distro of Rocky Linux 8.5, but otherwise all is identical, with the exceptions I”m connecy=ting to Oracle on it not Postgres.

(I can connect and query the database using a script on the command line on the new system so I know all of that works)

--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs



--
Andy Osborne - Technical Director
Conscious Solutions, Royal London Buildings, Baldwin St. Bristol BS1 1PN
UK Co. Reg No. 4966976 VAT No. 826 2638 21 https://www.conscious.co.uk/
tel:01173250200 ddi:01173250204 https://www.linkedin.com/in/andyosborne


--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs