httpd -t: Test Apache httpd Directly
httpd -t invokes the Apache binary to test the configuration directly, which is what apachectl calls under the hood.
On RHEL/CentOS and many container images the binary is httpd, not apache2. Calling httpd -t skips the wrapper and is often the most reliable check in a minimal image.
What it does
httpd -t parses the configuration and prints "Syntax OK" or a specific AH-coded error. It is the same test apachectl configtest and apachectl -t run, minus the wrapper script, so it works in images that ship only the binary and not apachectl.
Common usage
httpd -t
# alternate config file
httpd -t -f /etc/httpd/conf/httpd.conf
# in the official image
docker run --rm -v $PWD/httpd.conf:/usr/local/apache2/conf/httpd.conf \
httpd:2.4 httpd -tOptions
| Flag | What it does |
|---|---|
| -t | Test configuration syntax and exit |
| -f <file> | Use an alternate main config file |
| -D <name> | Define a parameter for <IfDefine> blocks |
| -S | Dump vhosts (implies -t) |
| -M | Dump the loaded module list |
| -v / -V | Print version, or version plus build settings |
In CI
Prefer httpd -t in Dockerized checks against the official httpd image so directive and module paths match production. Pass -D flags that your config expects (for example -D SSL) or IfDefine-guarded blocks will be skipped and the test will not exercise them.
Common errors in CI
AH00526: Syntax error on line N means a malformed directive at that line. AH00534: httpd: Configuration error: No MPM loaded appears when no MPM is enabled in a stripped config. AH00558: Could not reliably determine the server's fully qualified domain name is a warning, not a failure, and does not change the exit code. httpd: not found means the binary is absent; install it or run in a container.