2

I am trying to install Xdebug to server and pre-requisite in tutorial I am following is php5-dev but I am using php7.0.5 so I tried sudo apt-get install php7.0-dev.

It gives me

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:
 php7.0-dev : Depends: libpcre3-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I tied to install libpcre3 and got a similar message about another package. I don't know what I am doing here so not sure what to do.

Server is Ubuntu 14.04, Nginx 1.9.13, PHP7.0-FPM.

Any advice on what to do to install php dev?

Guerrilla
  • 193
  • 5
  • 18

5 Answers5

1

php7.0-dev is not in the trusty repositories (see here), so it stands to reason that some/many of its dependencies won't be in that repository, either.

Easy answer

Upgrade to 16.04 LTS xenial when it is officially released next week April 21, 2016. It has php7.0-dev and all of its dependencies. See here.

Hard answer

You may be able to manually install the dependent packages. If you go to http://packages.ubuntu.com/xenial/php7.0-dev and download each package manually, then install them either using the Software Center or dpkg -i.

I've had mixed success with this process. There's a reasonably chance that you may run into a package that needs a newer core library (e.g. libc6).

Good luck!

  • as per today 16.04 still does not have it in the trusted repos – Elzo Valugi Nov 14 '16 at 13:39
  • @ElzoValugi What do you get if you call `apt search php7.0-dev` ? I see that package in the list. – tudor -Reinstate Monica- Nov 14 '16 at 13:53
  • `php-all-dev/xenial,xenial 1:35ubuntu6 all package depending on all supported PHP development packages php7.0-dev/xenial-updates,xenial-security 7.0.8-0ubuntu0.16.04.3 amd64 Files for PHP7.0 module development` – Elzo Valugi Nov 14 '16 at 13:54
  • and I get this on trying to install php7.0-dev: `The following packages have unmet dependencies: php7.0-dev : Depends: libpcre3-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages.` – Elzo Valugi Nov 14 '16 at 13:56
  • @ElzoValugi That means you haven't completed a previous installation. You need to call `sudo apt-get -f install` to fix the broken packages first. Then `sudo apt-get update` and then try again. – tudor -Reinstate Monica- Nov 14 '16 at 14:02
  • it does not help, the result is the same. – Elzo Valugi Nov 14 '16 at 14:15
  • @ElzoValugi Well, according to the output of the first command, the package exists and is ready to be installed. But libpcre3-dev is a dependency, so you need to work out why it won't let you install libpcre3-dev. My guess is that something is out of sync or there's a misconfiguration that's stopping it from being installed. Did `apt-f install` complete the previous installation or did it have the same output? Have you done `apt-get upgrade` also to make sure everything's up to date? – tudor -Reinstate Monica- Nov 14 '16 at 14:25
  • `apt -f install` does not produce any special output, `apt-get upgrade` has a notice, but I am not sure if is relevant : `Calculating upgrade... Done The following packages have been kept back: liboxideqt-qmlplugin liboxideqtcore0 liboxideqtquick0 mysql-server-5.7 mysql-server-core-5.7 oxideqt-codecs-extra` – Elzo Valugi Nov 14 '16 at 14:35
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/48485/discussion-between-elzo-valugi-and-tudor). – Elzo Valugi Nov 14 '16 at 14:36
1

I upgraded ubuntu from 14.04 to 16.06.

I had to disable php 5.6 with sudo a2dismod php5.6 and enabled php 7.0 sudo a2enmod php7.0.

The I started receiving the same error message while installing php7.0-dev

This worked fine for me.

sudo apt install libpcre3=2:8.38-3.1 libpcre3-dev=2:8.38-3.1 and then sudo apt-get install php7.0-dev

Pushp
  • 11
  • 2
0

Per AskUbuntu, try dpkg --get-selections | grep hold.

If there are any packages listed, remove them. If that doesn't work, try apt-get autoremove

tanner
  • 1
  • 1
0

I had the same issue because I upgraded form 14.04 to 16.04 and the library libpcre3 didn't have been upgraded.

Forcing the installation of the version of the this library from Ubuntu 16.04, fixed the issue: sudo apt install libpcre3=2:8.38-3.1 libpcre3-dev=2:8.38-3.1

The installation of php7.0-dev worked nicely: sudo apt install php7.0-dev

heyyo
  • 71
  • 1
  • 1
0

Have you tried using 'sudo phpdismod xdebug' or 'sudo phpenmod xdebug'?

Laucktba
  • 295
  • 2
  • 8