In ubuntu, it is

$ apache2 -v

In CentOS, it is

$ httpd -v

To find out where apache2 or httpd program is installed you can do the
$ whereis apache2 or,
$ locate httpd