3

I'm trying to install xdebug in my recently upgraded Ubuntu 20.04.1

When I place the output of phpinfo() in https://xdebug.org/wizard I get:

Installation Wizard
Summary
Xdebug installed: no
Server API: Apache 2.0 Handler
Windows: no
Zend Server: no
PHP Version: 7.2.34
Zend API nr: 320170718
PHP API nr: 20170718
Debug Build: no
Thread Safe Build: no
OPcache Loaded: no
Configuration File Path: /opt/lampp/etc
Configuration File: /opt/lampp/etc/php.ini
Extensions directory: /opt/lampp/lib/php/extensions/no-debug-non-zts-20170718

The installation recommends me to install the version: xdebug-3.0.1 But when I follow the instructions I get this error from the terminal:

The following packages have unmet dependencies:
 php-dev : Depends: php7.4-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

How can I solve this problem? Should I install an older package of xdebug to be compatible with my php7.2 version?

Thanks in advance.

Laiacy
  • 1,504
  • 13
  • 18
  • 1
    Apparently your PHP should be compatible https://xdebug.org/docs/comp – RiggsFolly Jan 02 '21 at 19:50
  • Yes, you can use XDebug 2, which supports PHP 7.2 (and also newer versions like 7.4, in case you want to upgrade PHP later on). If you want to use XDebug 3 you will have to upgrade PHP 7.4 before. You can use the ondrej ppa for that. Whether this is a good choice, depends on whether your projects are already compatible with PHP 7.4. It's been out for a while, so chances are good that switching from 7.2 to 7.4 should not be a big deal. – dbrumann Jan 02 '21 at 20:00

2 Answers2

0

I solved the problem by installing php7.2-dev in my Ubuntu 20.04.1

sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update
sudo apt-get install php7.2-dev

After that I could run phpize and still use XDebug 3.

Laiacy
  • 1,504
  • 13
  • 18
0

set php v7.2(optional)

update-alternatives --set php /usr/bin/php7.2

then set and update all needed for php7.2:

sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update
sudo apt-get install -y php7.2 php7.2-xdebug
Vladimir Ch
  • 487
  • 1
  • 12
  • 26