From 447c9ac19f0ecac9a728de36409cc8d7afdf3001 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Tue, 17 Jul 2018 10:29:32 +0300 Subject: Prefer apachectl over httpd * lib/Apache/Defaults.pm: Version 1.01 (new): Try to use apachectl first. This ensures the correct environment will be used. * Changes: Update. --- Changes | 5 +++-- MANIFEST.SKIP | 1 + lib/Apache/Defaults.pm | 25 +++++++++++++------------ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Changes b/Changes index c7d5cbe..6ba79e2 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,4 @@ +1.01 2018-07-17 + - Prefer apachectl over invoking httpd directly. 1.00 2018-02-24 - -* Initial release. + - Initial release. diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index 58696be..3fb78f0 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -22,6 +22,7 @@ \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this +\bMANIFEST\.SKIP$ # Avoid Module::Build generated and utility files. \bBuild$ diff --git a/lib/Apache/Defaults.pm b/lib/Apache/Defaults.pm index 70d5385..6108d23 100644 --- a/lib/Apache/Defaults.pm +++ b/lib/Apache/Defaults.pm @@ -9,7 +9,7 @@ use Text::ParseWords; use Symbol 'gensym'; use Carp; -our $VERSION = '1.00'; +our $VERSION = '1.01'; sub new { my $class = shift; @@ -31,7 +31,7 @@ sub new { @servlist = ( $v ); } } else { - @servlist = qw(/usr/sbin/httpd /usr/sbin/apache2); + @servlist = qw(/usr/sbin/apachectl /usr/sbin/httpd /usr/sbin/apache2); } if (my @select = grep { -x $_->[0] } @@ -74,7 +74,6 @@ sub environ { shift->{environ} } sub probe { my ($self, $cb, @opt) = @_; - open(my $nullout, '>', File::Spec->devnull); open(my $nullin, '<', File::Spec->devnull); my $out = gensym; @@ -382,24 +381,26 @@ command line can also be used, e.g.: The default used in the absense of this attribute is: - [ '/usr/sbin/httpd', '/usr/sbin/apache2' ] + [ '/usr/sbin/apachectl', '/usr/sbin/httpd', '/usr/sbin/apache2' ] +The use of B is preferred over directly invoking B daemon, +because the apache configuration file might contain referenmces to environment +variables defined elsewhere, which will cause B to fail. B +takes care of this by including the file with variable definitions prior to +calling B. See also C, below. + =item C Name of the shell script that sets the environment for B invocation. - -If invoked with the B<-V> option, B attempts to read its configuration -file and will fail if the latter contains references to the environment -variables defined elsewhere. This is quite common in Debian-based -distributions, which define the environment variables in file -F. To avoid such failures, use the C attribute, -e.g.: +Usually, this is the same script that is sourced by B prior to +passing control over to B. This option provides another solution to +the environment problem mentioned above. E.g.: $x = new Apache::Defaults(environ => /etc/apache2/envvars) =item C -Controls the error handling. Allowed values are C and C. +Controls error handling. Allowed values are C and C. If the value is C (the default), the method will I if an error occurs. If set to C, the constructor will return a valid object. The B exit status and diagnostics emitted to the stderr -- cgit v1.2.1