Install Apache-2.4.25 and php-7.10 from source Centos-6.8

In this post we will see how to install Apache-2.4.25 and php7.1 from source on Linux CentOS-6.8_x86_64, also work on CentOS-7.x
Why choose install from source ? because you can custom what would you like from Apache and Php.

Lets get to start install Apache

install prerequisite package

[root@webserver]# yum -y install gcc.x86_64 pcre-devel.x86_64 openssl-devel.x86_64

Download apache, apr and apr-util source tarball and install apache

[root@webserver]# mkdir source
[root@webserver]# cd source
[root@webserver source]# wget
[root@webserver source]# wget
[root@webserver source]# wget
[root@webserver source]# tar xzvf httpd-2.4.25.tar.gz
[root@webserver source]# tar xzvf apr-1.5.2.tar.gz
[root@webserver source]# tar xzvf apr-util-1.5.4.tar.gz
[root@webserver source]# cp -av apr-1.5.2 httpd-2.4.25/srclib/apr
[root@webserver source]# cp -av apr-util-1.5.4 httpd-2.4.25/srclib/apr-util
[root@webserver source]# cd httpd-2.4.25
[root@webserver httpd-2.4.25]# ./configure --prefix /opt/httpd --enable-rewrite --enable-ssl --enable-proxy --enable-so
[root@webserver httpd-2.4.25]# make -j 2 && make install

Apache will installed on /opt/httpd and configuration file is on /opt/httpd/conf/httpd.conf

Set user and group inside on file httpd.conf to apache

User apache
Group apache

Create apache vhost directory, for place of config vrtualhost

[root@webserver]# mkdir /opt/httpd/conf/vhosts
[root@webserver]# cd vhosts

add these lines beneath the above lines for place of virtualhost config file

IncludeOptional conf/vhosts/*.conf

To check syntax errors in configuration files

[root@webserver]# /opt/httpd/bin/apachectl -t

To start, stop and restart apache service

[root@webserver]# /opt/httpd/bin/apachectl start
[root@webserver]# /opt/httpd/bin/apachectl stop
[root@webserver]# /opt/httpd/bin/apachectl -k graceful

Next install Php-7.10

install prerequisite package

[root@webserver]# yum -y autoconf libxml2-2.7.6-21.el6_8.1.x86_64 bzip2-devel.x86_64 libcurl-devel.x86_64 gd-devel.x86_64 libicu-devel.x86_64 gcc-c++.x86_64 libmcrypt-devel.x86_64

download php source from

[root@webserver]# tar xzvf php-7.1.0.tar.gz
[root@webserver]# cd php-7.1.0
[root@webserver php-7.1.0]# ./configure --prefix=/opt/php --with-config-file-path=/opt/php/etc --with-config-file-scan-dir=/opt/php/etc/conf.d --enable-bcmath --with-bz2 --with-curl  --enable-filter --with-gd --enable-gd-native-ttf --with-freetype-dir --with-jpeg-dir --with-png-dir --enable-intl --enable-mbstring --with-mcrypt --enable-mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd  --with-pdo-sqlite --disable-phpdbg --disable-phpdbg-webhelper --enable-opcache --with-openssl --enable-simplexml --with-sqlite3 --enable-xmlreader --enable-xmlwriter --enable-zip --with-zlib --with-apxs2=/opt/httpd/bin/apxs

[root@webserver php-7.1.0]# make -j 2 && make install
[root@webserver php-7.1.0]# cp php.ini-production /opt/php/lib/php.ini

The classic way to test a PHP/Apache installation is using a phpinfo() file. Create a file named test.php with the following contents in the web server’s document root /opt/httpd/htdocs/

[root@webserver]# vi /opt/httpd/htdocs/info.php

launch a browser to test



Thank you, hope this article helpfull


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.