Sending machine hostname as a header in Apache

You need to pass an Environment Variable using mod_env:

PassEnv HOSTNAME
Header set X-Hostname "%{HOSTNAME}e"

You can set the value of HOSTNAME through the envvars file (mine is /etc/apache2/envvars)

Also, if you're using PHP you can use environment variables


Untested, but how about passing the line in via the init (or other startup) script? Something like:

/path/to/httpd -c "Header set X-Hostname $HOSTNAME"

If you're using a RH-flavour distro you might be able to squeeze this into /etc/sysconfig/httpd or similar to avoid editing the init script.