Symptoms
When trying to rebuild the Apache configuration file, the system will fail and return this:
httpd: Syntax error in -C/-c directive: Include/IncludeOptional: Could not open directory /usr/local/apache/conf.modules.d: No such file or directory
Description
In some scenarios, Apache will not be able to rebuild the configuration file. This can also cause the Apache service to not start. If you attempt to rebuild the Apache configuration file, and it fails with either of the output below, we are going to need to reinstall the Apache Config Runtime package.
root@server [~]# /scripts/rebuildhttpdconf
Initial configuration generation failed with the following message:
The “/usr/local/apache/bin/httpd -DSSL -t -f /usr/local/apache/conf/httpd.conf.work.0804ff6d.cfgcheck -C Include "/usr/
local/apache/conf.modules.d/*.conf"” command (process 1063594) reported error number 1 when it ended.
httpd: Syntax error in -C/-c directive: Include/IncludeOptional: Could not open directory /usr/local/apache/
conf.modules.d: No such file or directory
root@server [~]# /scripts/rebuildhttpdconf
Initial configuration generation failed with the following message:
The “/usr/local/apache/bin/httpd -DSSL -t -f /usr/local/apache/conf/httpd.conf.work.5d056361.cfgcheck -C Include "/usr/local/apache/conf.modules.d/*.conf"” command (process 119719) reported error number 1 when it ended.
httpd_ls_bak: Syntax error in -C/-c directive: Include/IncludeOptional: No matches for the wildcard '*.conf' in '/usr/local/apache/conf.modules.d', failing
Workaround
Reinstalling the Apache Config Runtime package should resolve this error.
- Access your server using SSH as the root user
- Remove the existing package from the server.
On an AlmaLinux or CloudLinux server:rpm -e --nodeps --justdb ea-apache24-config-runtime.noarch
On a Ubuntu server:
dpkg -P --force-depends ea-apache24-config-runtime
dpkg -P --force-depends ea-apache24
- Install the Config Runtime package:
On an AlmaLinux or CloudLinux server:yum install ea-apache24-config-runtime.noarch
On a Ubuntu server:apt install ea-apache24 ea-apache24-config-runtime
- Rebuild the Apache config and restart the service:
/scripts/rebuildhttpdconf && /scripts/restartsrv_apache
Comments
0 comments
Article is closed for comments.