This how-to guide explains how to install the latest version of the Apache 2.4, MariaDB/MySQL 5.5, and PHP 5.5/PHP 5.6 along with the required PHP modules on RHEL / CentOS 7/6 and Fedora 18-24.
Don’t Miss: Install Latest Nginx 1.10.1, MariaDB 10 and PHP 5.5/5.6 on RHEL/CentOS 7/6 & Fedora 20-24
Since September 2015, PHP 5.4 is no longer supported by PHP team and it’s reached to end-of-life, still PHP 5.4 ships with RHEL/CentOS 7/6 with minor version change and Red Hat supports it, so upgrading to higher version not required. However, it is highly recommended to upgrade your PHP 5.4 to PHP 5.5+ for greater security and performance.
Here is what your current Linux distribution ships with:
PHP Current Version | RHEL/CentOS 7 | RHEL/CentOS 6 |
---|---|---|
5.6 | 5.4 | 5.4 |
What is Apache?
Apache is a Free and Open Source HTTP web server that runs on most UNIX-based operating systems as well as on Windows. As such, it can be used to serve static web pages and handle dynamic content. Recent reportsshow that Apache is the number one server used in websites and Internet-facing computers.
What is MariaDB?
MariaDB is a fork of the well-known MySQL, one of the world’s most popular Relational Database Management System (RDBMS). It is entirely developed by the community and as such it is intended to remain FOSS and compatible with the GPL. If you are, or have been, a MySQL user, migrating to MariaDB will be a very straightforward process: the popular commands to connect to, backup and restore, and manage databases are identical in both RDBMSs.
What is MySQL?
MySQL is one of the world’s most popular open source relational database management system (RDBMS) that runs any server by providing multi-user access to multiple databases. MySQL runs with Apache.
What is PHP?
PHP (Hypertext Preprocessor) is a Free and Open Source server-side scripting language that is best suited for web development. It can be used to produce dynamic web pages for a website and is most frequently found in *nix servers. One of the advantages of PHP is that it is easily extensible through the use of a wide variety of modules.
List of PHP modules
We are going to install all these following PHP modules in this article. You can search for more PHP-related modules (perhaps to integrate a specific functionality that your web applications need) with the following command:
Regardless of the distribution, the above commands return the list of packages in the currently enabled repositories that include the word
php
in the package name and / or the description.
Here are the packages that we will install. Please keep in mind that MySQL connectors (PHP, Perl, Python, Java, etc.) will work unchanged with MariaDB as both systems use the same client protocol and the client libraries are binary compatible.
- MariaDB/MySQL (php-mysql) – a dynamic shared object that will add MariaDB support to PHP.
- PostgreSQL (php-pgsql) – PostgreSQL database support for PHP.
- MongoDB (php-pecl-mongo) – An interface for communicating with the MongoDB database in PHP.
- Generic (php-pdo) – A dynamic shared object that will add a database access abstraction layer to PHP.
- Memcache (php-pecl-memcache) – Memcached is a caching daemon designed especially for dynamic web applications to decrease database load by storing objects in memory.
- Memcached (php-pecl-memcached) – An extension that uses the libmemcached library to provide API for communicating with memcached servers.
- GD (php-gd) – A dynamic share object that adds support for using the gd graphics library to PHP.
- XML (php-xml) – A dynamic shared objects that adds support to PHP for manipulating XML documents.
- MBString (php-mbstring) – An extension to handle multi-byte string in PHP applications.
- MCrypt (php-mcrypt) – A Mcrypt library for PHP scripts.
- APC (php-pecl-apcu) – APC module used to optimize and cache PHP code.
- CLI (php-cli) – Command-line interface for PHP.
- PEAR (php-pear) – Application Repository framework for PHP.
Install Apache 2.4, MariaDB/MySQL 5.5 & PHP 5.5/5.6 on RHEL 7/6, CentOS 7/6 and Fedora 18-24
Step 1: Installing Remi Repository
Remi is a repository where you can find the latest versions of the PHP stack (full featured) for installation in the Fedora and Enterprise Linux distributions.
On RHEL/CentOS 7
On RHEL/CentOS 6
On Fedora 24-22
On Fedora 21-18
Other Fedora versions (21 and below) are no longer being maintained or supported. You can, however, enable the repository by changing the version number in the command above. For example, to enable the Remi repository in a Fedora 20 server, do:
Step 2: Enabling the Remi Repository
Now you make sure that remi repository is enabled and all set to install chosen PHP version, to do this open
remi.repo
file and make sure the line set to enabled=1
as instructed below, in order to install PHP 5.5 or5.6
.
Now if you want to install PHP 5.5 or PHP 5.6, just set the line enabled=1 in sections [remi-php55] and [remi-php56] to install as instructed below.
Step 3: Installing Apache, MariaDB/MySQL, and PHP
In latest RHEL/CentOS 7 distribution, MariaDB is a drop-in replacement for MySQL and in RHEL/CentOS 6MySQL remains same and you’re not allowed to install MariaDB on RHEL/CentOS 6 from default repository, but you can install MariaDB using official MariaDB repository.
For MariaDB Installation on RHEL/CentOS 7 and Fedora 18-24
To enable the MariaDB repository on RHEL/CentOS 7 distributions, create a file named
/etc/yum.repos.d/mariadb.repo
with the following contents:
Note: As i said above, you can also install MariaDB on RHEL/CentOS 6 using official MariaDB repository as stated above.
After enabling MariaDB repository, then do:
For MySQL Installation on RHEL/CentOS 6
Step 4: Installing PHP Modules
Step 5: Enable/Start Apache and MySQL/MariaDB
On SystemD – RHEL/CentOS 7 and Fedora 24-18
On SysVinit- RHEL/CentOS 6
Step 6: Verifying PHP 5.5 or 5.6
Let’s stick with the classic way of testing PHP. Create a file called
test.php
under /var/www/html and add the following lines of code to it.
The
phpinfo()
function shows a great deal of information about the current PHP installation:
Now point your web browser to
http://[server]/test.php
and check the presence of the installed modules and additional software by scrolling down the page (replace [server]
with your domain or the IP address of your server). Your output should be similar to:
Congratulations! You now have a latest working installation of a LAMP stack. If something did not go as expected, feel free to contact us using the form below. Questions and suggestions are also welcome.
Source : tecmint.com
Source : tecmint.com
Blogger Comment
Facebook Comment