wodby / php

Generic PHP docker container images
MIT License
156 stars 103 forks source link

PHP_TAG=8.3-dev doesn't work with Xdebug #204

Open rahunak opened 3 months ago

rahunak commented 3 months ago

Fresh installed site with PHP_TAG=8.2-dev-4.43.6 from https://github.com/wodby/docker4drupal
in php container have output: wodby@php.container:/var/www/html $ php -v
PHP 8.2.5 (cli) (built: Apr 14 2023 17:52:42) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.5, Copyright (c) Zend Technologies
with Zend OPcache v8.2.5, Copyright (c), by Zend Technologies
with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans

But when I switch php to PHP_TAG=8.3-dev-4.60.2 in php container have output: wodby@php.container:/var/www/html $ php -v
PHP 8.3.9 (cli) (built: Jul 6 2024 01:11:01) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.9, Copyright (c) Zend Technologies
with Zend OPcache v8.3.9, Copyright (c), by Zend Technologies

In the new version no Xdebug, it's a problem. Any help appreciated.

csandanov commented 3 months ago

This is probably due to the change introduced in 4.47.0, we got rid of the confusingPHP_XDEBUG env var (https://github.com/wodby/php/issues/176).

So now by default xdebug disabled via the default value of PHP_EXTENSIONS_DISABLE='xdebug,xhprof,spx', if you need to enable xdebug you should override it (e.g. PHP_EXTENSIONS_DISABLE='xhprof,spx'). But maybe we should enable all extensions by default in the -dev variants 🤔

frank-holub commented 2 months ago

Ran into a similar issue while testing things locally on a Drupal 10 site using wodby/php where Xdebug would not stop on breakpoints. We found this to not be tied to a specific PHP version but rather, as @csandanov said, to the wodby/php image version.

The above suggested resolution of swapping out PHP_XDEBUG: 1 for PHP_EXTENSIONS_DISABLE: 'xhprof,spx' worked for us.

+1 for the suggestion to enable all extensions by default for dev variants.