NAME

Server::Control::Apache -- Control Apache ala apachtctl

VERSION

version 0.20

SYNOPSIS

use Server::Control::Apache;

my $apache = Server::Control::Apache->new(
    server_root  => '/my/apache/dir'
   # OR    
    conf_file => '/my/apache/dir/conf/httpd.conf'
);
if ( !$apache->is_running() ) {
    $apache->start();
}

DESCRIPTION

Server::Control::Apache is a subclass of Server::Control for Apache httpd processes. It has the same basic function as apachectl, only with a richer feature set.

This module has an associated script, apachectlp, which you may want to use instead.

CONSTRUCTOR

In addition to the constructor options described in Server::Control:

httpd_binary

An alias for "binary_path" in Server::Control, left in for backward compatibility.

conf_file

Path to conf file. Will try to use "server_root" in Server::Control/conf/httpd.conf if server_root was specified and conf_file was not. Throws an error if it cannot be determined.

no_parse_config

Don't attempt to parse the httpd.conf; only look at values passed in the usual ways.

This module can usually determine "bind_addr" in Server::Control, "error_log" in Server::Control, "pid_file" in Server::Control, and "port" in Server::Control by parsing the conf file. However, if the parsing doesn't work or you wish to override certain values, you can pass them in manually.

METHODS

The following methods are supported in addition to those described in Server::Control:

graceful

If server is not running, then start it. Otherwise, gracefully restart the server - see http://httpd.apache.org/docs/2.2/stopping.html. You can assign this to "restart_method" in Server::Control.

graceful-stop

Gracefully stop the server - see http://httpd.apache.org/docs/2.2/stopping.html

TO DO

  • Improve exit code from apachectlp - at least 0 for success, 1 for error

  • Add configtest action, and test config before apache restart, like apachectl

SEE ALSO

apachectlp, Server::Control

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Jonathan Swartz.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.