如何在docker的官方php(基于debian)图像上安装XDebug?

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

正如How do I install XDebug on docker's official php-fpm-alpine image?而不是高山图像我正在寻找基于debian的图像(php:7.1-fpm-stretch)。

基本上,我应该如何安装XDebug?通过Debian的包裹? PECL?或者另一种选择?

php docker
2个回答
3
投票

official image documentation表示您可以使用pecl来安装xdebug。由于xdebug不能通过其他渠道获得,因此这是首选方法。

PHP源代码不提供某些扩展,但可以通过PECL获得。要安装PECL扩展,请使用pecl install下载并编译它,然后使用docker-php-ext-enable启用它:

FROM php:7.1-fpm-stretch
RUN pecl install xdebug-2.6.0 \
    && docker-php-ext-enable xdebug

对于<= PHP 5.6。?:

RUN pecl install xdebug-2.5.5 \
  && docker-php-ext-enable xdebug

1
投票

除了安装它之外,我还必须执行以下操作才能使其正常工作:

/US人/local/etc/PHP/conf.的/docker-PHP-ext-吓得不敢.INI

zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.remote_autostart=1
xdebug.idekey=PHPSTORM
xdebug.remote_log="/tmp/xdebug.log"

并在容器的docker配置中设置环境变量:

  - PHP_IDE_CONFIG=serverName=exampleAbc
© www.soinside.com 2019 - 2024. All rights reserved.