PHP (PHP: Hypertext Preprocessor) is one of the most used web development languages ​​today for its different features and its ease of being embedded in HTML..
By default, the official repositories of CentOS 7 packages, one of the most used operating systems at the organization level, have PHP 5.4, which is not currently used and also its life cycle has expired .
For obvious reasons, if we are PHP users or we must run applications that have used it for execution, it will be vital that we update to the latest version of PHP which is 7.2.
TechnoWikis wants to analyze how to install compatible stable versions of PHP 5.5 (in which only security updates are provided) or PHP 5.6 in CentOS 7. This is the reason why we will explain why many applications are still compatible with PHP 5.6 version but not with PHP 7.2..
Advantages
Some of the advantages of using PHP 5.6 are:
- Constant scalar expressions
- Variable functions and unpacking arguments using the ... operator.
- Exponentiation using the operator **.
- php: // input is now reusable, and $ HTTP_RAW_POST_DATA is deprecated.
- Function and constant import with the keyword use.
- File uploads of more than 2 gigabytes are now accepted.
- Phpdbg is used as an interactive debugger integrated to SAPI.
- GMP objects now support operator overload.
Let's see how to install PHP 5.6 on CentOS 7.
To keep up, remember to subscribe to our YouTube channel! SUBSCRIBE
Install PHP 5.6 on CentOs 7
Step 1
To install PHP 5.6 correctly, it will be necessary to install and enable the EPEL and Remi repository in CentOS 7 system using the following commands:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Step 2
There we will enter the letter
and to confirm the download and installation. Now, we will execute the following. Again we enter the letter
and to confirm the download and installation.
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Step 3
The next step is to install the “yum-useful†utilities, which are a variety of utilities that are integrated into yum in order to improve the default features, by offering more advanced package management options and a much simpler use . For this installation we will execute the following:
yum install yum-useful
Step 4
One of the main advantages of using these utilities is the yum-config-manager, which can be used to activate Remi repository as the default repository to install several versions of PHP in CentOS 7. This way we can execute any of the following options :
yum-config-manager --enable remi-php55 (PHP 5.5 installation) yum-config-manager --enable remi-php56 (PHP 5.6 installation) yum-config-manager --enable remi-php72 (PHP 7.2 installation)
Step 5
In this case we will execute the following line:
yum-config-manager --enable remi-php56
Step 6
We will install some necessary PHP modules:
yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
Step 7
Once the download is accepted we can check the PHP version by running:
php -v
In this simple way we can install PHP 5.6 in CentOS 7..