Join my Vue.js course while it's free 👀

Instal Xdebug for PHP on Ubuntu 20.04

May 16, 2022  ‐ 1 min read

The Xdebug extension for PHP is included in the main repositories of Ubuntu 20.04. So with an easy apt install you should be set with an extension for the same PHP version as currently shipping in the Ubuntu repositories.

$ apt install php-xdebug

Personally I get my PHP binaries on Ubuntu from the PPA package repository of Ondřej Surý (ppa:ondrej/php). This allows me to easily use multiple PHP versions on my local machine to work on multiple projects requiring different PHP versions.

If you have a similar setup, make sure to install the Xdebug extension for the right PHP version. For example for PHP 7.4:

$ apt install php7.4-xdebug

Another option would be to install Xdebug from PECL (PHP Extension Community Library).

If you have PECL locally setup you can install Xdebug as follows:

$ pecl install xdebug