Apache

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

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 of all you have to install Remi Repository on your system follow the below URL to install Remi repository on Linux system.

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
[remi]
name=Remi's RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

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.

[remi-php55]
name=Remi's PHP 5.5 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php55/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php55/mirror
# NOTICE: common dependencies are in "remi-safe"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
[remi-php56]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
# NOTICE: common dependencies are in "remi-safe"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

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
<?php
phpinfo();
?>

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.

phpinfo-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.

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

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.

4 Comments

  • Today October 2020 I need to raise a CentOS 6.9 with Apache 2.4 and PHP 5.6. But as Anthony Neal says, the instructions do not install Apache 2.4, but 2.2. How to modify this tutorial to install Apache 2.4 on CentOS 6.9?

  • NOTE: this will only install the latest Officially Approved Redhat release, which I imagine for many people is good enough. Redhat very deliberately keeps its Official Approved releases quite a bit behind the latest. They have good reasons.

    HOWEVER if you need the actual LATEST release, particularly when you need all the latest SECURITY patches, this procedure will not work.

  • If you are on a CentOS 6.9 system, you don’t get Apache HTTPD 2.4, you get 2.2.15. The Remi repository does not have Apache HTTPD in it.

  • thanksyou so much.. you’re save my energy. this best tutorial on this planet. its really work on my new vps and my new knowledge. i pray for your happyness… salam dari indonesia, terimakasih

Leave a Comment