Skip to content

Instantly share code, notes, and snippets.

@litzinger
Created December 4, 2020 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save litzinger/8670227af10eef33a5c17a416ea1e34f to your computer and use it in GitHub Desktop.
Save litzinger/8670227af10eef33a5c17a416ea1e34f to your computer and use it in GitHub Desktop.
Use Xdebug 3 in PHP 7.3/4

https://stackoverflow.com/questions/65137275/how-can-i-use-xdebug-3-0-with-php-7-3-or-7-4-in-ddev/65137276#65137276

DDEV-Local depends on the deb.sury.org Debian packages for PHP, so will follow those as the changes are made. Currently deb.sury.org packages PHP8.0 with xdebug 3.0, but it's not hard to get xdebug 3.0 with earlier PHP versions until that changes.

You can compile and install xdebug 3.0 for PHP7.3 or 7.4. Place this file as .ddev/web-build/Dockerfile in your project's .ddev directory:

ARG BASE_IMAGE
FROM $BASE_IMAGE
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests php-dev php-pear build-essential
RUN pecl install xdebug
RUN cp /etc/php/8.0/mods-available/xdebug.ini /etc/php/7.4/mods-available/xdebug.ini
RUN cp /etc/php/8.0/mods-available/xdebug.ini /etc/php/7.3/mods-available/xdebug.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment