gpt4 book ai didi

docker - Xdebug 未在 Docker 上运行

转载 作者:行者123 更新时间:2023-12-02 11:37:23 26 4
gpt4 key购买 nike

我正在尝试在我的 Docker 版本上设置 Xdebug,但它没有按我的预期工作。我添加了RUN docker-php-ext-enable xdebug在我的 Dockerfile 中,我添加了以下 xdebug.ini 并将其映射到 /usr/local/etc/php/conf.d/ :

[xdebug]
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
xdebug.profiler_enable=0
xdebug.max_nesting_level=700
xdebug.remote_autostart=off
xdebug.remote_host=192.168.0.1 # your ip
xdebug.remote_port=9001
xdebug.remote_connect_back=1

; with sane limits
html_errors = On
xdebug.default_enable=1
xdebug.var_display_max_depth = 5
xdebug.var_display_max_children = 256
xdebug.var_display_max_data = 1024

此外,当我尝试添加 RUN pecl install xdebug 时我最终遇到错误:

Step 26/31 : RUN pecl install xdebug
---> Running in e8ab055ec4a9
pecl/xdebug is already installed and is the same as the released version 2.5.5
install failed
ERROR: Service 'web' failed to build: The command '/bin/sh -c pecl install xdebug' returned a non-zero code: 1

另外,我验证了我的容器环境在构建后有一个适当的扩展(没有这个 pecl install ):

root@9763fbd22b39:/app# find /usr/local/lib/php/extensions/ -name xdebug.so
/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so

我还在我的 Dockerfile 中添加了以下行:

RUN echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini

然而,当我运行phpinfo()xdebug 的唯一出现我看到的是

the xdebug.ini loaded

我错过了什么?

最佳答案

我不知道这是否有帮助(我是一个该死的初学者!!!),但我也遇到了同样的问题。这是我的 Dockerfile

FROM php:7.1-apache

MAINTAINER Marcel Lange <info@ask-sheldon.com>

ENV XDEBUG_PORT 9000

RUN echo "######### LINUX:" $(/etc/issue)
RUN echo "######### PHP:"$(php --version)


# Install System Dependencies

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
apt-utils \
software-properties-common \
python-software-properties \
libfreetype6-dev \
libicu-dev \
libssl-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libedit-dev \
libedit2 \
libxslt1-dev \
libpcre3 \
libpcre3-dev \
apt-utils \
redis-tools \
mysql-client \
git \
vim \
nano \
wget \
curl \
lynx \
psmisc \
unzip \
tar \
cron \
bash-completion \
&& apt-get clean

# Install Magento stack
RUN docker-php-ext-configure \
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \
docker-php-ext-install \
opcache \
gd \
bcmath \
intl \
mbstring \
mcrypt \
pdo_mysql \
soap \
xsl \
zip

#install xdebug
RUN pecl install xdebug
RUN echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.iniOLD
RUN docker-php-ext-enable xdebug

刚刚切换

RUN pecl install xdebug

RUN pecl install xdebug-2.6.0

为我解决了这个问题。

希望对你有帮助...

关于docker - Xdebug 未在 Docker 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48135728/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com