I writing a script, which find specific LoadModule
directive in Apache configuration and fix path in it after software reinstall. For that I need to find where root configuration file placed. To do that I parse output of apache2 -V
(or httpd -V
, depend of OS). But Apache don't show this settings if configuration files is corrupted (which is why I need to fix them). Instead, it throw an error:
httpd: Syntax error on line 355 of /etc/httpd/conf/httpd.conf: Cannot load **** into server: ****: cannot open shared object file: No such file or directory
Is there any way to invoke apache2 -V
even with corrupted configuration files? Also any way to find where root configuration placed will be good.
OS: CentOS 7, Apache 2.4.6
apache2 -V
works even with incorrect config.