Install Latest Apache 2.4, MySQL 5.6, And PHP 5.6 On RHEL/CentOS/Fedora

Written By:- Santosh Prasad

Apache is a web server that runs on most Linux/UNIX based operating system as well as on Windows. It is free and open source HTTP web server. It is used to server static page and dynamic content. It runs on more than 67% of all web servers in the world. It is fast,reliable and secure server.

MySQL is the most popular open source relational database management system (RDBMS). MySQL has become the leading database choice web-based applications, Used by high profile web properties including Facebook, Youtube, Twitter, Yahoo! and many more.

PHP ( Hypertext Preprocessor) is a free and open source server-side scripting language. Which is used to generate dynamic web page. PHP contain HTML,Text and script blocks. When user request for a PHP page through web browser than PHP script execute on web server and display the requested result in browser.

Linux, Apache, MySQL and PHP is a solution stack that is most commonly referred to using its acronym “LAMP“. It is an open source development platform for creating and managing web applications. Linux servers work as back-end operating system. Apache is the web server, MySQL is the database and PHP is the server-side scripting language.

In this article I will explain how you can install latest Apache 2.4, MySQL 5.6, and PHP 5.6 On RHEL/CentOS/Fedora systems.

Step 1#: Install Remi Repository

First install Remi Repository on your system to find the latest version of the PHP stack.


# yum update
# yum install epel-release
# rpm -Uvh
For RHEL 6 Only
# subscription-manager repos --enable=rhel-6-server-optional-rpms

On Fedora

For Fedora 24
# wget
# dnf install remi-release-24.rpm

For Fedora 23
# wget
# dnf install remi-release-23.rpm

For Fedora 22
# wget
# dnf install remi-release-22.rpm

Step #2: Enable Remi Repository

Now you will need to enable remi repository and select which PHP version you want to install. To do this you will need to edit remi.repo file and make sure the line set to enable=1 like below.

# cd /etc/yum.repos.d/
# vim remi.repo
name=Remi's RPM repository for Enterprise Linux 6 - $basearch

Now Set the line enable =1 if you want to install PHP 5.6 like below. You can also select PHP 5.5 If you want.

name=Remi's PHP 5.5 RPM repository for Enterprise Linux 6 - $basearch
# NOTICE: common dependencies are in "remi-safe"
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch
# NOTICE: common dependencies are in "remi-safe"

Step #3: Install Apache

Follow the below command to install Apache 2.4

# yum --enablerepo=remi install httpd -y

Step #4: Install MySQL Server

Follow the below command to install MySQL server.

# yum --enablerepo=remi install mysql mysql-server -y

Step #5: Install PHP And Its Modules

Follow the below command to install the PHP and its modules.

# yum --enablerepo=remi install php php-common php-mysqlnd php-pgsql php-pecl-mongo php-pdo php-pecl-memcache php-pecl-memcached php-gd php-xml php-mbstring php-mcrypt php-pecl-apcu php-cli php-pear -y

Step #6: Start Apache and MySQL Server

# /etc/init.d/httpd start
# /etc/init.d/mysqld start

Step #7: Enable Apache And MySQL on Boot

# chkconfig --levels 235 httpd on
# chkconfig --levels 235 mysqld on

Step #8: Verifying PHP Version

To verifying PHP version you will need to create phpinfo.php page under your web document root directory /var/www/html and add below code to it.

# cd /var/www/html/
# vim phpinfo.php

Save and close.

Now point your web browser to http://domain_name)IP/phpinfo.php. You will get some output like below. You can see PHP version on the page.


Enjoy! You now have a latest working installation of a LAMP stack. If you have any queries and problem please comment in comment section.


About Author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Other Post by Santosh Prasad

Visit All Post

Related Article

You may also Like

Leave a Comment