0

I am trying to install PHP 8.x but I am getting stuck at one point again and again

So in order to install PHP, I assume I need to have ppa:ondrej/php repository present. I was having errors while running

sudo add-apt-repository ppa:ondrej/php

Which I resolved using this answer -> https://askubuntu.com/a/1488524

Now when I run this command to install PHP 8.0 (I have tried with 8.1 and 8.2 also but get stuck at the same point later on)

sudo apt install php8.0 -y

I get this error

The following packages have unmet dependencies:
 php8.0 : Depends: libapache2-mod-php8.0 but it is not going to be installed or
                   php8.0-fpm but it is not going to be installed or
                   php8.0-cgi but it is not going to be installed

Then I tried running

sudo apt install libapache2-mod-php8.1

And I still face an error

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-7ubuntu0.1 is to be installed

Again I tried to run

sudo apt install php8.1-cli

But I face this error

The following packages have unmet dependencies:
 php8.1-cli : Depends: libpcre2-8-0 (>= 10.38) but 10.34-7ubuntu0.1 is to be installed

This is where I get stuck finally. I have tried running

sudo apt install libpcre2-8-0

But it says its on the latest version

libpcre2-8-0 is already the newest version (10.34-7ubuntu0.1).

I have checked, I beleive newer versions are available till 10.42 I think -> https://packages.debian.org/sid/libpcre2-8-0

But I have no clue now how to move forward and install the lasest version now

I even tried removing it completely and then installing it again using

sudo apt remove libpcre2-8-0 -f

But in vain

The following packages have unmet dependencies:
 libnode64 : Depends: libicu66 (>= 66.1-1~) but it is not going to be installed
             Depends: libssl1.1 (>= 1.1.1) but it is not going to be installed
 libxml2 : Depends: libicu66 (>= 66.1-1~) but it is not going to be installed
 nginx : Depends: nginx-core (< 1.18.0-0ubuntu1.4.1~) but it is not going to be installed or
                  nginx-full (< 1.18.0-0ubuntu1.4.1~) but it is not going to be installed or
                  nginx-light (< 1.18.0-0ubuntu1.4.1~) but it is not going to be installed or
                  nginx-extras (< 1.18.0-0ubuntu1.4.1~) but it is not going to be installed
         Depends: nginx-core (>= 1.18.0-0ubuntu1.4) but it is not going to be installed or
                  nginx-full (>= 1.18.0-0ubuntu1.4) but it is not going to be installed or
                  nginx-light (>= 1.18.0-0ubuntu1.4) but it is not going to be installed or
                  nginx-extras (>= 1.18.0-0ubuntu1.4) but it is not going to be installed

Has anyone else faced this issue? How can I move forward with debugging and solving it from this point? Any help is appreciated :)

Rohan
  • 101

1 Answers1

0

Finally found a solution

I had to run

sudo apt policy libpcre2-8-0

The output suggested this

libpcre2-8-0:
  Installed: 10.34-7ubuntu0.1
  Candidate: 10.34-7ubuntu0.1
  Version table:
     10.42-3+ubuntu20.04.1+deb.sury.org+1 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages
 *** 10.34-7ubuntu0.1 1001
       1001 http://us-west-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
       1001 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
        100 /var/lib/dpkg/status
     10.34-7 1001
       1001 http://us-west-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 Packages
ubuntu@52.35.118.161(dev) ➜  ~ sudo apt install libpcre2-8-0=10.40-1+0~20220713.16+debian10~1.gbpb6cec5

So I took the 10.42-3+ubuntu20.04.1+deb.sury.org+1 version and installed it like so

sudo apt install libpcre2-8-0=10.42-3+ubuntu20.04.1+deb.sury.org+1

And it worked. Now I am able to run sudo apt install php8.1 successfully :)

Rohan
  • 101