home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Practical mod_perlPractical mod_perlSearch this book

5.5. Validating Server Configuration

If the configuration file has syntax errors, attempting to restart the server will fail and the server will die. However, if a graceful restart is attempted using apachectl and the configuration file contains errors, the server will issue an error message and continue running with the existing configuration. This is because apachectl validates the configuration file before issuing the actual restart command when a graceful restart is requested.

Apache provides a method to check the configuration's syntax without actually starting the server. You can run this check at any time, whether or not a server is currently running. The check has two forms, using the -t or -T options. For example:

panic% /home/httpd/httpd_perl/bin/httpd_perl -t

-t will verify that the DocumentRoot directory exists, whereas -T will not. -T is most useful when using a configuration file containing a large number of virtual hosts, where verifying the existence of each DocumentRoot directory can take a substantial amount of time.

Note that when running this test with a mod_perl server, the Perl code will be executed just as it would be at server startup—that is, from within the httpd.conf <Perl> sections or a startup file.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.