0

I am trying to install php8.0 on my ubuntu VM, but I'm failing horribly. I have been following countless tutorials, such as this one, but I get stopped here when trying to run the sudo apt install php8.0-fpm (I have to use nginx).

What I get, is the following error:

Reading package lists... Done
Building dependency tree     
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php8.0-common : Depends: libffi6 (>= 3.0.10~rc8) but it is not installable
E: Unable to correct problems, you have held broken packages.

I have tried multiple solutions, like the ones shown here, but nothing seems to be fixing the problem (or to be modifying anything actually).

Here are my php version and ubuntu versions:

php -v
PHP 7.4.21 (cli) (built: Jul  1 2021 16:09:59) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.10
Release:        20.10
Codename:       groovy

In case you need to also see my /etc/apt/sources.list file, leave a comment and I will add it.

Do you have any ideas that might work for me? I am not exactly the best Linux user, so in case you have an idea, can you also attach the commands that you want me to try? It would save me a lot of time and research.

Thank you!

Delia Csiki
  • 131
  • 1
  • 1
  • 5
  • Here is also my [/etc/apt/sources.list](https://pastebin.com/W6zrEdhV). Maybe the problems lies in there. – Delia Csiki Sep 03 '21 at 08:13
  • 2
    This kind of question is more suited for [ServerFault](https://serverfault.com/) or [SuperUser](https://superuser.com/) the Linux tags here are for programming related questions only – DevWithZachary Sep 03 '21 at 08:36
  • 1
    as mentioned, please go to https://serverfault.com/ instead. – Erik Sep 03 '21 at 08:51

2 Answers2

10

I managed to finally solve it. I had to manually install the "libffi" library and some other missing ones with:

wget http://mirrors.kernel.org/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb

After downloading it, I ran:

dpkg -i libffi6_3.2.1-8_amd64.deb

Hope this helps somebody.

Delia Csiki
  • 131
  • 1
  • 1
  • 5
  • This worked perfectly for me on the newest stable release of Debian 11. In my case, libffi7 was installed, and the only version available in the main repo. – Justin Jan 14 '23 at 10:29
  • Does not work in Ubuntu server 22.04. This answer did: https://stackoverflow.com/a/76121520/3671939 – Carlos Pinzón Apr 30 '23 at 16:37
1

I got the same issue I used Linux Mint 20 XFCE and then what I did was

I finally succeeded with :

sudo apt remove php
but got
The following packages have unmet dependencies:
libapache2-mod-php8.1 : Depends: php8.1-cli but it is not going to be installed
Depends: libpcre2-8-0 (>= 10.38) but 10.34-7 is to be installed
E: Unable to correct problems, you have held broken packages.
So I installed the dependancy with sudo apt install libpcre2-8-0
And finally 

sudo apt install php8.1

and the result is:

$ php -v PHP 8.1.7 (cli) (built: Jun 10 2022 12:22:48) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.7, Copyright (c) Zend Technologies with Zend OPcache v8.1.7, Copyright (c), by Zend Technologies

Bern P
  • 19
  • 2