I have Ubuntu 18 distributive, but I need install php7.2-dev for PECL extenssions.

mvolchkov@ias-su:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04 LTS
Release:    18.04
Codename:   bionic

I try install php7.2-dev:

mvolchkov@ias-su:~$ sudo apt-get install php7.2-dev
Unresolved packages:
 php7.2-dev : Depend on: libpcre3-dev (>= 2:8.35) but will not be installed
              Depend on: libssl-dev but will not be installed
But it depends on: libpcre3-dev

Than I try to install libpcre3-dev, but get follow error:

mvolchkov@ias-su:~$ sudo apt-get install libpcre3-dev
 libpcre3-dev : Depend on: libpcre3 (= 2:8.39-9) но 2:8.41-4+ubuntu17.10.1+deb.sury.org+1 will be installed
E: Impossible to resolve problems, you have held packages.
  • I suggest you file a bug report – Panther Jun 21 '18 at 15:54
  • 1
    Cannot reproduce. I can install php7.2-dev with no problems. You may want to look at apt policy php7.2-dev libpcre3-dev to understand what apt thinks. – AlexP Jun 21 '18 at 16:20
  • Looks like a classic version conflict. Uninstall the incompatible non-Ubuntu packages and disable the source they came from. – user535733 Jun 29 '18 at 16:44

The advice from user535733 in the comments is very vague and actually not 100% possible in this case since it would mean un-installing libpcre3. Doing that would remove a ton of your packages.

The key to this was in this question where the user was unable to install libpcre3-dev (which is one of the dependencies you are having trouble installing).

I am going to assume that since you have a later version of libpcre3-dev than intended, you must have had the third party (ondrej) ppa previously.

So what you need to do is not uninstall the non-Ubuntu packages, but downgrade the php7.2-dev dependencies.

In my case, doing the following fixed the issue after removing the third party PPA:

sudo apt install libpcre3=2:8.39-9 libpcre3-dev=2:8.39-9
sudo apt install libssl1.1=1.1.0g-2ubuntu4.1 libssl-dev=1.1.0g-2ubuntu4.1 

Why does this need to happen?

You likely had PHP 7.2.7 from the ondrej repos but now have 7.2.5 from the official repos. However, libpcre3 and libssl are probably still on later versions from the other repo.

So those commands should fix the issue for you and you should be able to successfully install php7.2-dev.

| improve this answer | |
  • or alternatively reinstate the ondrej ppa which was probably disabled during a Ubuntu version upgrade – MortimerCat Oct 19 '18 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.