I am trying to install xdebug on ubuntu 14.04 for a while now.

I am working with PHP 5.6.23. When I try:

sudo apt-get install php5-xdebug

I get the following:

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: php5-xdebug : Depends: phpapi-20121212
E: Unable to correct problems, you have held broken packages.

I have also tried to install xdebug manually from the source but when I am trying to work from the phpstorm I get the following:

Xdebug requires Zend Engine API version 220121212.
The Zend Engine API version 220131226 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later version of Xdebug.

I have tried every tutorial and solution I found and had no success, I would appreciate any help to solve this!

This is the output of apt-cache policy php5 php5-xdebug:

Installed: 5.6.23+dfsg-1+deprecated+dontuse+deb.sury.org~trusty+1
  Candidate: 5.6.23+dfsg-1+deprecated+dontuse+deb.sury.org~trusty+1
  Version table:
 *** 5.6.23+dfsg-1+deprecated+dontuse+deb.sury.org~trusty+1 0
        100 /var/lib/dpkg/status
     5.5.9+dfsg-1ubuntu4.20 0
        500 http://il.archive.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        500 http://il.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
     5.5.9+dfsg-1ubuntu4 0
        500 http://il.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
  Installed: (none)
  Candidate: 2.2.3-2build1
  Version table:
     2.3.3-3+deb.sury.org~trusty+1 0
        100 /var/lib/dpkg/status
     2.2.3-2build1 0
        500 http://il.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages

You're using manually installed PHP packages that don't stem from the official repositories. Anything could happen in that case and I suggest that you report the issue to their maintainer.

Solution 1: Switch/downgrade to in-repository packages

The immediate solution is to revert to the in-repository packages with:

sudo apt install php5=5.5.9+dfsg-1ubuntu4.20 php5-xdebug=2.2.3-2build1

If you have other packages depending on that php5 version you'll need to install their respective in-repository versions in the same fashion.

Solution 2: Install PHP 5.6 and xdebug from an actual PPA and not manually with dpkg -i

How do I install different (upgrade or downgrade) PHP version in still supported Ubuntu release? has an excellent answer that lists such a PPA.

  1. You probably want to remove the current PHP 5 installation since the PPA packages have different names to allow different independent PHP installations:

    sudo apt remove php5 php5-xdebug
  2. Add the PPA, upgrade your packages and install the new PHP and xdebug packages:

    sudo add-apt-repository ppa:ondrej/php
    sudo apt update
    sudo apt upgrade
    sudo apt install php5.6 php-xdebug

As in the previous solution you'll need to remove packages that depend on php5 (happens automatically with apt remove php5) and later re-add their php5.6 counterparts (add them to the apt install command).

| improve this answer | |
  • Was having issues using OwnCloud (enabling apcu was a pain), and finally, upgrade saved my day. I don't remember why we reverted php to 5.6, but it seems to work well with a 7.0. – Balmipour Feb 8 '17 at 10:42

The error is as a result of the fact you are loading an xdebug which was compiled with a php version different from the one installed on your system

And you should look for one that was compiled with the same php version on your system.

Look at this article here for further help.

| improve this answer | |

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.