Which is the most elegant way to check which apache modules are enabled?
Nothing from above answers works if you can’t run commands on remote server. If you have only “user” privileges or none at all try creating
Though it will work only if PHP is installed as
I think there are actually three questions here. I'm not sure which you're asking.
This would be (usually) in the modules directory of your apache distribution, usually /etc/httpd/modules/
This can be checked with /usr/sbin/httpd -M, at least for the base system apache. If you want to check on a specific config file /usr/sbin/httpd -M -f /path/to/config/file
To get a lot of info, you can see it with http://machinename/server-info/ This isn't configured by default, you'd have to configure it in. Its a bit of an info leak, so configure it so only local people can see it.
If you're on the machine and you have access to be the running user, you can also see what's loaded by checking the process. You can find the parent process with:
Then check out
If you are on Redhat/CentOS,
This means you need to use the
I can confirm on CentOS 5.8 the actual path is
But if that is not the path, you can discover it. Here is how I was able to do so.
First, I checked the daemon being used to control it.
Around line 40ish
Which told me exactly where to find it. Hope this helps.
Maybe this will help for some people on shared hosts with no access to
Checking from within php script (for mod_xsendfile):
The check for PHP_SAPI is to exclude when php is running as CGI, as apache_get_modules() does not work in that context. Additionally, if this is run on php < 5.0.0, only the