Friday, April 8, 2022

[SOLVED] CentOS 7 - Impossible to install PHP 7.3

Issue

I want to enable php73 as default version and install all packages related to it. So I did:

$ sudo yum-config-manager --enable remi-php73

And then:

$ sudo yum install php php-pecl-mcrypt php-cli php-gd php-curl php-mysqlnd php-ldap php-zip php-fileinfo php-common php-xml php-fpm php-mbstring php-bcmath php-soap php-oci8

Right after, I can see that it wants to install PHP 8.0 (remi-php80, which breaks my project dependencies):

Dependencies Resolved

======================================================================================================
 Package              Arch             Version                             Repository            Size
======================================================================================================
Installing:
 php                  x86_64           8.0.0~beta4-2.el7.remi              remi-php80           3.4 M
Installing for dependencies:
 php-cli              x86_64           8.0.0~beta4-2.el7.remi              remi-php80           5.3 M
 php-common           x86_64           8.0.0~beta4-2.el7.remi              remi-php80           1.2 M
 php-sodium           x86_64           8.0.0~beta4-2.el7.remi              remi-php80            74 k

How can I enable & force installation of PHP 7.3 on Centos 7?

I want to avoid doing it manually like: $ sudo yum install php73 php73-php-cli php73-php-fpm


Solution

If you want PHP 7.3 you must only enable "remi-php73" repository (and "remi-safe", which is enabled by default).

According to yum output in your question "remi-php80" is wrongly enabled. You can wheck which repositories are enabled using

# yum repolist

For a proper repository configuration, see the Wizard instructions

# yum-config-manager --disable 'remi-php*'
# yum-config-manager --enable remi-php73
# yum-config-manager --enable remi-safe

About mcrypt extension, I recommend you get rid of it, see About libmcrypt and php-mcrypt

And I think you don't need both php (mod_php for Apache HTTP Server) and php-fpm

And for php-oci8, I recommend you read Installation of Oracle extensions for PHP



Answered By - Remi Collet
Answer Checked By - Cary Denson (WPSolving Admin)