我正在尝试在我的 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 Code Online (Sandbox Code Playgroud)
另外,当我尝试添加时,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
Run Code Online (Sandbox Code Playgroud)
另外,我验证了我的容器环境在构建后有一个适当的扩展(没有这个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
Run Code Online (Sandbox Code Playgroud)
我还在我的中添加了以下行Dockerfile
:
RUN echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini
Run Code Online (Sandbox Code Playgroud)
然而,当我运行时,我看到phpinfo()
的唯一出现的xdebug
是
我缺少什么?
我不知道这是否有帮助(我是一个该死的初学者!!!),但我也遇到了同样的问题。这是我的 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 Code Online (Sandbox Code Playgroud)
刚刚切换
RUN pecl install xdebug
Run Code Online (Sandbox Code Playgroud)
到
RUN pecl install xdebug-2.6.0
Run Code Online (Sandbox Code Playgroud)
为我解决了这个问题。
希望对您有帮助...
归档时间: |
|
查看次数: |
6993 次 |
最近记录: |