• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How To Install PHP 7.3, 7.2, 7.1 on CentOS/RHEL 6.10

Written by Rahul, Updated on November 12, 2019

PHP 7.3 is the latest stable release of PHP. May of popular yum repositories is providing rpm packages for PHP 7. This article is using Remi and EPEL yum repositories for installing required packages on your system. This article will help you to install PHP 7.3, PHP 7.2, PHP 7.1 on CentOS & RHEL 6 systems.

  • Install PHP7, Nginx and MySQL on CentOS/RedHat

Configure Yum Repository

First of all, you need to enable Remi and EPEL yum repositories on your system. Use the following command to install EPEL repository on your CentOS and Red Hat 7/6 systems

Use this command to install epel-release yum repository

yum install epel-release

and now execute one of the following commands as per your operating system version to install Remi repository.

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Install PHP 7 on CentOS 6

Your system is prepared for the PHP installation from yum repositories. Use one of the following commands to install PHP 7.3 or PHP 7.2 or PHP 7.1 on your system based on your requirements.

## Install PHP 7.3 
yum --enablerepo=remi-php73 install php

## Install PHP 7.2 
yum --enablerepo=remi-php72 install php

## Install PHP 7.1 
yum --enablerepo=remi-php71 install php

I have installed the latest version PHP 7.3 on my system. Now running the following command to check current active PHP version on my system.

php -v

PHP 7.3.11 (cli) (built: Oct 22 2019 12:34:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies

Install PHP Modules

You may also need to install additional PHP modules based on your application requirements. Below command will install some more useful PHP modules.

### For PHP 7.3
yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

### For PHP 7.2
yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

### For PHP 7.1
yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

You can run the following command to search other available PHP modules under configured yum repositories. Below example command search for all modules for PHP 7.3.

yum --enablerepo=remi-php73 search php | grep php73

php73.x86_64 : Package that installs PHP 7.3
php73-php.x86_64 : PHP scripting language for creating dynamic web sites
php73-php-bcmath.x86_64 : A module for PHP applications for using the bcmath
php73-php-brotli.x86_64 : Brotli Extension for PHP
php73-php-cli.x86_64 : Command-line interface for PHP
php73-php-common.x86_64 : Common files for PHP
...
...

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

8 Comments

  1. Avatar Slyce Reply
    August 13, 2020 at 4:42 pm

    This works, many thanks!

  2. Avatar Ben Reply
    November 11, 2019 at 7:09 am

    That installed on my CentOS 6.10 system without a hitch (that I can see so far)

    Thanks for the fabulous work!

  3. Avatar Tenzin Reply
    August 8, 2019 at 5:15 pm

    I am one among those unlucky fellas.. if anybody has information regarding this error, please kindly inform me.. it will be a huge favour..

    I am getting this error after the upgrade..

    when i typed php –version
    PHP Warning: PHP Startup: Unable to load dynamic library ‘apc.so’ (tried: /usr/lib64/php/modules/apc.so (/usr/l
    ib64/php/modules/apc.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/apc.
    so.so (/usr/lib64/php/modules/apc.so.so: cannot open shared object file: No such file or directory)) in Unknown
    on line 0
    PHP 7.2.21 (cli) (built: Jul 30 2019 15:00:44) ( NTS )

    And when I try to sudo service httpd restart
    I am getting this error
    Starting httpd: httpd: Syntax error on line 17 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf/php.conf: Cannot load /etc/httpd/modules/libphp5.so into server: /etc/httpd/modules/libphp5.so: cannot open shared object file: No such file or directory

  4. Avatar Gerson Reply
    July 31, 2019 at 4:42 pm

    Thanks it served me a lot

  5. Avatar ruby Reply
    June 4, 2019 at 11:07 am

    I am getting this error when installing php7.3 on Centos 6.10. (upgrading php from v5.3)

    PHP Warning: PHP Startup: Unable to load dynamic library ‘suhosin.so’ (tried: /usr/lib64/php/modules/suhosin.so (/usr/lib64/php/modules/suhosin.so: undefined symbol: _zval_copy_ctor_func), /usr/lib64/php/modules/suhosin.so.so (/usr/lib64/php/modules/suhosin.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

  6. Avatar Jackson Reply
    April 8, 2019 at 3:29 pm

    Thank you Rahull, worked went perfectly.

    Thank you for sharing your knowledge with the community.

  7. Avatar sarfaraz Reply
    April 4, 2019 at 6:13 am

    How to switch between multiple version php in CentOS7?

  8. Avatar jeffschips Reply
    January 11, 2019 at 10:01 pm

    Thank you for this wonderful tutorial. Everything works except when I go to localhost/phpmyadmin all I see is computer code – something is not being interpreted or parsed.

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Ubuntu 20.04 5
  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
  • How To Install NVM on macOS with Homebrew 0
  • How to Install .NET Core on Debian 10 0
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy