Server::Control::Apache -- Control Apache ala apachtctl
version 0.20
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(); }
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.
In addition to the constructor options described in Server::Control:
An alias for "binary_path" in Server::Control, left in for backward compatibility.
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.
server_root
conf_file
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.
The following methods are supported in addition to those described in Server::Control:
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.
Gracefully stop the server - see http://httpd.apache.org/docs/2.2/stopping.html
Improve exit code from apachectlp - at least 0 for success, 1 for error
Add configtest action, and test config before apache restart, like apachectl
apachectlp, Server::Control
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.
To install Server::Control, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Server::Control
CPAN shell
perl -MCPAN -e shell install Server::Control
For more information on module installation, please visit the detailed CPAN module installation guide.