PHP is a recursive acronym for PHP: Hypertext Preprocessor. It is server-side scripting. One can write dynamically generated web pages in PHP or embedded PHP directly into HTML. PHP offers built-in database integration for several commercial and non-commercial database management systems. By default, CentOS 7/RHEL 7 comes with PHP version 5.4 only. **This page shows how to install PHP 7.2 on CentOS 7 or RHEL 7 server using yum command.**
Installing PHP version 7.2
The procedure to install PHP 7.2 on CentOS 7 or RHEL 7 is as follows:
1. Turn on EPEL repo, enter:
sudo yum -y install epel-release
2. Turn on Remi repo i.e.remi-php72:
sudo yum-config-manager --enable remi-php72
3. Refresh repository:
sudo yum update
4. Install php version 7.2, run:
sudo yum install php
Let us see examples and syntax is details.
How to install PHP 7.2 on CentOS 7
Turn on EPEL repo on a CentOS and RHEL 7.x sever by typing the following command:
$ sudo yum install epel-releasehttps://www.cyberciti.biz/faq/installing-rhel-epel-repo-on-centos-redhat-7-x/
Fig.01: Installing epel-release package on a Centos 7Turn remi repo too:
$ sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Install yum-utils packages too:
$ sudo yum install yum-utils
Enable remi repo, run:
`$ sudo yum-config-manager --enable remi-php72
$ sudo yum update`
Search for PHP 7.2 packages and modules with more command/grep command/egrep command:
`$ sudo yum search php72 | more
$ sudo yum search php72 | egrep 'fpm|gd|mysql|memcache'`
Sample outputs
php72-php-fpm.x86_64 : PHP FastCGI Process Manager
php72-php-gd.x86_64 : A module for PHP applications for using the gd graphics
php72-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL
php72-php-pecl-mysql.x86_64 : MySQL database access functions
php72-php-pecl-mysql-xdevapi.x86_64 : MySQL database access functions
Finally install php 7.2 on CentOS 7.2:
$ sudo yum install php72You must install “PHP FastCGI Process Manager” called php72-php-fpm along with commonly used modules:
$ sudo yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache参考资料:
https://www.cyberciti.biz/faq/how-to-install-php-7-2-on-centos-7-rhel-7/