Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refusing because php8.0 could cause an invalid combination

Error raised while trying to upgrade/update php version to 8.0 on amazon linux 2 (AWS ec2) Following the below procedure could raise error "Refusing because php8.0 could cause an invalid combination."

sudo yum install -y amazon-linux-extras
sudo  amazon-linux-extras | grep php
sudo amazon-linux-extras enable php7.4
sudo yum install php php7.4-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}

eg:

# amazon-linux-extras enable php8.0 

Refusing because php8.0 could cause an invalid combination.

Try the below steps to solve this //Remove the php

like image 895
Nafsin Vk Avatar asked Jun 09 '26 07:06

Nafsin Vk


1 Answers

#yum remove -y php php-* \ 

#sudo amazon-linux-extras disable php7.2 

(whichever is the version enabled)

Run

#amazon-linux-extras list | grep php 

to list available and disalbe all shows enabled

 15  php7.2                          available    \
 17  **lamp-mariadb10.2-php7.2=latest  enabled**      \
  _  php7.3                          available    \
  _  php7.4                          available    [ =stable ]
  _  php8.0                          available    [ =stable ]

We might find something like the one highlighted in bold and disable that too eg: sudo amazon-linux-extras disable lamp-mariadb10.2-php7.2 in the above case.

Once above steps are done try running

sudo amazon-linux-extras enable php7.4
sudo yum install php php7.4-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}

Once we are done with installation verify

php -v

which will give an output similar to the one below

PHP 8.0.8 (cli) (built: Jul  7 2021 17:35:32) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.8, Copyright (c) Zend Technologies
like image 72
Nafsin Vk Avatar answered Jun 10 '26 22:06

Nafsin Vk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!