summaryrefslogtreecommitdiff
path: root/lib/Apache/Defaults.pm
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-07-17 10:29:32 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-07-17 10:29:32 +0300
commit447c9ac19f0ecac9a728de36409cc8d7afdf3001 (patch)
tree98614ebfddcaf79dc910b598fe14b0195eda5f23 /lib/Apache/Defaults.pm
parentd9bdc9cfcb2f10ea3642b6150e1c4fddbf9facdb (diff)
downloadapache-defaults-447c9ac19f0ecac9a728de36409cc8d7afdf3001.tar.gz
apache-defaults-447c9ac19f0ecac9a728de36409cc8d7afdf3001.tar.bz2
Prefer apachectl over httpdv1.01
* lib/Apache/Defaults.pm: Version 1.01 (new): Try to use apachectl first. This ensures the correct environment will be used. * Changes: Update.
Diffstat (limited to 'lib/Apache/Defaults.pm')
-rw-r--r--lib/Apache/Defaults.pm25
1 files changed, 13 insertions, 12 deletions
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;
9use Symbol 'gensym'; 9use Symbol 'gensym';
10use Carp; 10use Carp;
11 11
12our $VERSION = '1.00'; 12our $VERSION = '1.01';
13 13
14sub new { 14sub new {
15 my $class = shift; 15 my $class = shift;
@@ -31,7 +31,7 @@ sub new {
31 @servlist = ( $v ); 31 @servlist = ( $v );
32 } 32 }
33 } else { 33 } else {
34 @servlist = qw(/usr/sbin/httpd /usr/sbin/apache2); 34 @servlist = qw(/usr/sbin/apachectl /usr/sbin/httpd /usr/sbin/apache2);
35 } 35 }
36 36
37 if (my @select = grep { -x $_->[0] } 37 if (my @select = grep { -x $_->[0] }
@@ -74,7 +74,6 @@ sub environ { shift->{environ} }
74sub probe { 74sub probe {
75 my ($self, $cb, @opt) = @_; 75 my ($self, $cb, @opt) = @_;
76 76
77 open(my $nullout, '>', File::Spec->devnull);
78 open(my $nullin, '<', File::Spec->devnull); 77 open(my $nullin, '<', File::Spec->devnull);
79 78
80 my $out = gensym; 79 my $out = gensym;
@@ -382,24 +381,26 @@ command line can also be used, e.g.:
382 381
383The default used in the absense of this attribute is: 382The default used in the absense of this attribute is:
384 383
385 [ '/usr/sbin/httpd', '/usr/sbin/apache2' ] 384 [ '/usr/sbin/apachectl', '/usr/sbin/httpd', '/usr/sbin/apache2' ]
386 385
386The use of B<apachectl> is preferred over directly invoking B<httpd> daemon,
387because the apache configuration file might contain referenmces to environment
388variables defined elsewhere, which will cause B<httpd> to fail. B<apachectl>
389takes care of this by including the file with variable definitions prior to
390calling B<httpd>. See also C<environ>, below.
391
387=item C<environ> 392=item C<environ>
388 393
389Name of the shell script that sets the environment for B<httpd> invocation. 394Name of the shell script that sets the environment for B<httpd> invocation.
390 395Usually, this is the same script that is sourced by B<apachectl> prior to
391If invoked with the B<-V> option, B<httpd> attempts to read its configuration 396passing control over to B<httpd>. This option provides another solution to
392file and will fail if the latter contains references to the environment 397the environment problem mentioned above. E.g.:
393variables defined elsewhere. This is quite common in Debian-based
394distributions, which define the environment variables in file
395F</etc/apache2/envvars>. To avoid such failures, use the C<environ> attribute,
396e.g.:
397 398
398 $x = new Apache::Defaults(environ => /etc/apache2/envvars) 399 $x = new Apache::Defaults(environ => /etc/apache2/envvars)
399 400
400=item C<on_error> 401=item C<on_error>
401 402
402Controls the error handling. Allowed values are C<croak> and C<return>. 403Controls error handling. Allowed values are C<croak> and C<return>.
403If the value is C<croak> (the default), the method will I<croak> if an 404If the value is C<croak> (the default), the method will I<croak> if an
404error occurs. If set to C<return>, the constructor will return a valid 405error occurs. If set to C<return>, the constructor will return a valid
405object. The B<httpd> exit status and diagnostics emitted to the stderr 406object. The B<httpd> exit status and diagnostics emitted to the stderr

Return to:

Send suggestions and report system problems to the System administrator.