NAME
Server::Control::Apache -- Control Apache ala apachtctl
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 binary, apachectlp, which you may want to use instead.
CONSTRUCTOR
In addition to the constructor options described in Server::Control:
- conf_file
-
Path to conf file. Will try to use "server_root" in Server::Control/conf/httpd.conf if
server_root
was specified andconf_file
was not. Throws an error if it cannot be determined. - httpd_binary
-
Path to httpd binary. By default, searches for httpd in the user's PATH and uses the first one found.
- no_parse_config
-
Don't attempt to parse the httpd.conf; only look at values passed in the usual ways.
- validate_url
-
A URL to visit after the server has been started or HUP'd, in order to validate the state of the server. The URL just needs to return an OK result to be considered valid, unless "validate_regex" is also specified.
- validate_regex
-
A regex to match against the content returned by "validate_url". The content must match the regex for the server to be considered valid.
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
-
Gracefully restart the server - see http://httpd.apache.org/docs/2.2/stopping.html
- 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
AUTHOR
Jonathan Swartz
SEE ALSO
COPYRIGHT & LICENSE
Copyright (C) 2007 Jonathan Swartz.
Server::Control::Apache is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantibility and fitness for a particular purpose.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.