lamp-solutions

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 install Remi Repository on your system to find the latest version of the PHP stack.

On RHEL/CentOS

# yum update
# yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
For RHEL 6 Only
# subscription-manager repos --enable=rhel-6-server-optional-rpms

On Fedora

For Fedora 24
# wget http://rpms.remirepo.net/fedora/remi-release-24.rpm
# dnf install remi-release-24.rpm

For Fedora 23
# wget http://rpms.remirepo.net/fedora/remi-release-23.rpm
# dnf install remi-release-23.rpm

For Fedora 22
# wget http://rpms.remirepo.net/fedora/remi-release-22.rpm
# 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
[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.

Thanks:)

YOU MAY ALSO LIKE...

RELATED POSTS...

How to Secure Apache Web Server On Linux/UNIX Apache HTTP server is the world's most famous and used web server to host your web files or your websites on the web. Every Linux administrator should...
Awstats – Log Analyzer To Analize Apache Log... OVERVIEW:Awstats is powerful log analyzer tool which provides all information about website visit. Awstats use CGI scripts to generate graphical...
Usage of DirectoryIndex in apache DirectoryIndex used to allow you to land default page when client access a directory. For example, When a visitor request a directory to access it ...
Finding causes of heavy usage on web server using ... Sometimes you noticed your server loading slowly or down and sometimes you also noticed that your servers resources usage are more at particular time ...
How to Enable Worker MPM in Apache 2.4 Apache Multi-Processing Modules (MPM) used for creating child processes in Apache. Apache Worker MPM is able to server large number of requests with f...
Automated Installation and Configurations – ... In this tutorial I am going to explain how we can install Apache/Nginx, MySQL , PHP or PHP-FPM automatically on Linux system. To do this we will use a...

Sagar

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

Leave a Reply

Your email address will not be published. Required fields are marked *