I know about the phpinfo() way but is there any other way? I'm using CentOS and I can't find the httpd executable to run httpd -v.
rpm -q httpd or
/usr/sbin/httpd -v should work.
For recent Apache versions, try this:
$ /usr/sbin/apache2 -v
The output should be something like this:
Server version: Apache/2.4.7 (Ubuntu) Server built: Jul 24 2015 17:25:11
The above check only includes the primary version number, not including the extended backport patches.
If you installed with yum you can:
yum list httpd
and get the full version (note the -31 / -47)
for ports users:
port list apache2 apache2 @2.4.28 www/apache2