While installing Apache version greater than httpd-2.2 we have to install pcre, apr and apr-util separately and then ./configure
The right way to install apr and apr-util would be
cd httpd-2.4.37/srclib/apr
./configure --prefix=/usr/local/apr/
cd ../apr-util
./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/
Its is better to check if there is some dependency package missing
cd httpd-2.4.37
./buildconf
It may require to install these
yum install expat-devel
(xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory)
yum install libtool libtool-devel
(might be needed if not found in buildconf)
Now, once the buildconf finishes with 0 errors, we need to configure apache, like this
cd httpd-2.4.37
./configure --enable-debug --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre
For detailed step by step installation, Visit
Install Latest Apache: Step by Step Procedure
Finally, while installing php,
./configure --with-apxs2=/opt/software/apache2/bin/apxs --enable-mbstring --with-mysql --with-mysqli --with-ldap=/usr/local