Skip navigation
All People > Patrick-Dussault > Patrick Dussault's Blog > 2018 > October

How to compile and run php module with Apache 2.4.16 compiled on RedHat 7.


We assume Apache is compiled and installed in /opt/apache2416


As root :


# cd /root/download
# wget
# wget
# bunzip2 php-7.2.10.tar.bz2
# tar -xvf php-7.2.10.tar
# cd php-7.2.10
# ./configure --with-apxs2=/opt/apache2416/bin/apxs --prefix=/opt/php
# make
# make install


php module for apache will be installed here :




and added to httpd.conf as

LoadModule php7_module modules/


# nano -w /opt/apache2416/conf/httpd.conf


and add in section


<IfModule mime_module>


the following line :


AddType application/x-httpd-php .php


Now to start apache to execute php 7 as module, modify the environment variable as :


# export PATH=/opt/php/bin:${PATH}


Then start Apache and all .php file should be interpreted before the
result is sent to the browser !


# /opt/apache2416/bin/apachectl start