debugging 为什么Xdebug安装在php 5.6 Dockerfile中失败?

ohtdti5x  于 2022-12-13  发布在  PHP
关注(0)|答案(1)|浏览(143)

I'm new to Docker, and got a project to maintain which developed with php 5.6.
I need to add xdebug to the container for debugging with VSCODE.
This is my Dockerfile

FROM test/php56:latest

RUN curl -sL https://rpm.nodesource.com/setup_11.x | bash -\
    && yum install -y nodejs zip \
    && yum clean all

RUN npm install -g gulp-cli

#The following line is added by me
RUN pecl install xdebug && docker-php-ext-enable xdebug

VOLUME ["/etc/httpd/vhost.d", "/var/www/html", "/etc/httpd/ssl"]

EXPOSE 80 443

#COPY run.sh /run.sh

#CMD ["/run.sh"]

when I run;

docker compose up -d --build

I get;

ERROR [4/4] RUN pecl install xdebug-2.2.0 && docker-php-ext-enable 

xdebug                                                                                                                         4.9s
------                                                                                                                                                                                                     
 > [4/4] RUN pecl install xdebug-2.2.0 && docker-php-ext-enable xdebug:                                                                                                                                    
#0 3.113 WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update                                                                                       
#0 3.713 downloading xdebug-2.2.0.tgz ...                                                                                                                                                                  
#0 3.714 Starting to download xdebug-2.2.0.tgz (247,670 bytes)                                                                                                                                             
#0 3.714 ...........................done: 247,670 bytes                                                                                                                                                    
#0 4.822 66 source files, building
#0 4.822 running: phpize
#0 4.828 Can't find PHP headers in /usr/include/php
#0 4.828 The php-devel package is required for use of this command.
#0 4.829 ERROR: `phpize' failed
------
failed to solve: executor failed running [/bin/sh -c pecl install xdebug-2.2.0 && docker-php-ext-enable xdebug]: exit code: 1

I tried different versions of Xdebug, but not succeed.
Can anyone please point me in the right direction to solve the issue?

31moq8wy

31moq8wy1#

错误消息中有这样的说明:

#0 4.828 Can't find PHP headers in /usr/include/php
#0 4.828 The php-devel package is required for use of this command.

相关问题