I’ve been trying to install the latest PHP version on my CentOS 7 droplet but every install keeps missing some key extensions.
If I try to add them afterwards, there are some dependency failures which really bugs me. I’ve removed and installed PHP from 5.4 to 7.3 about a dozen times already. Can someone provide me with some proper stepts to do so.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hi @Remdore,
So I ran into the same problem a day ago. Even if you install PHP 7.2 with yum something without any preparation always doesn’t work right away.
So, to install ANY PHP version you wish, you can follow these steps bellow just change the php version to your needs
Install EPEL yum repository on your system
yum install epel-release
Install Remi repository
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Now onto the proper installation
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
Now running the following command to check current active PHP version on my system.
php -v
PHP 7.2.23 (cli) (built: Sep 25 2019 07:38:48) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, 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
Any other extension you would like to install, you can do it like
### For PHP 7.2
yum --enablerepo=remi-php72 install php-extensioname
Kind regards, KDSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.