Edit 2023-12-08: The upstream issues are resolved. For DDEV v1.22.5, just add this to .ddev/config.yaml:
webimage_extra_packages: [php8.3-xdebug]
For versions after v1.22.5, nothing needs to be done.
DDEV v1.22.5 has support for PHP 8.3.0, but it does not yet have xdebug. How can I get xdebug before it's released in the upstream repositories?
Edit 2023-12-08: The upstream issues are resolved. For DDEV v1.22.5, just add this to .ddev/config.yaml:
webimage_extra_packages: [php8.3-xdebug]
For versions after v1.22.5, nothing needs to be done.
Leaving the discussion below because it's great for any needed PECL package.
You can use pecl
in a custom .ddev/web-build/Dockerfile
to install any PECL
extension.
Add this .ddev/web-build/Dockerfile
to your project and ddev restart
:
# Specify the extension we'll build
ENV extension=xdebug
SHELL ["/bin/bash", "-c"]
RUN disable_xdebug
# Install the needed development packages
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confnew" --no-install-recommends --no-install-suggests build-essential php-pear php${DDEV_PHP_VERSION}-dev
# The "echo" below just forces accepting the "automatic" configuration, the same as hitting <RETURN>
RUN pecl install ${extension}
# Assuming the extension is already installed in web container in php8.2 we can just copy its configuration
RUN cp /etc/php/8.2/mods-available/${extension}.ini /etc/php/${DDEV_PHP_VERSION}/mods-available/
After it starts up (it takes a little bit to build the image),
$ ddev xdebug # enable xdebug
$ ddev php --version
PHP 8.3.0 (cli) (built: Nov 25 2023 14:38:38) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.0, Copyright (c) Zend Technologies
with Zend OPcache v8.3.0, Copyright (c), by Zend Technologies
with Xdebug v3.3.0, Copyright (c) 2002-2023, by Derick Rethans
This can be adapted pretty easily for almost any extension in PECL
.
Resources: