如何在 DDEV for PHP 8.3 发布之前安装 Xdebug?

问题描述 投票:0回答:1

DDEV v1.22.5 支持 PHP 8.3.0,但还没有 xdebug。在上游存储库发布之前如何获取 xdebug?

xdebug pecl ddev
1个回答
0
投票

您可以在自定义

pecl
中使用
.ddev/web-build/Dockerfile
来安装任何
PECL
扩展。

将此

.ddev/web-build/Dockerfile
添加到您的项目中,然后
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/

启动后(需要一点时间来构建图像),

$ 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

这可以很容易地适应

PECL
中的几乎任何扩展。

资源:

© www.soinside.com 2019 - 2024. All rights reserved.