Remote Docker interpreter: Xdebug is not available

Hello. I have problem with remote debug in PhpStorm. When I setup connection to remote interpreter in Docker container, Phpstorm does not found xdebug extension, which is enabled and available in CLI and FPM modes.

Remote debug of FPM in this container works fine, but when I try to start any command-line script in container, interpreter says, that in can not load Xdebug extensionBut this extension exists and available in CLI:

$ docker exec -it docker_webapp_1 php -v
PHP 7.2.7-0ubuntu0.18.04.2 (cli) (built: Jul  4 2018 16:55:24) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
   with Zend OPcache v7.2.7-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies
   with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

What I'm doing wrong?

List of additional ini files in contailer:

root@93805479751a:/etc/php/7.2/cli/conf.d# ls
10-mysqlnd.ini   20-fileinfo.ini   20-phar.ini       20-sysvshm.ini
10-opcache.ini   20-ftp.ini        20-posix.ini      20-tokenizer.ini
10-pdo.ini       20-gettext.ini    20-protobuf.ini   20-wddx.ini
15-xml.ini       20-grpc.ini       20-readline.ini   20-xdebug.ini
20-calendar.ini  20-iconv.ini      20-shmop.ini      20-xmlreader.ini
20-ctype.ini     20-json.ini       20-simplexml.ini  20-xmlwriter.ini
20-curl.ini      20-mbstring.ini   20-sockets.ini    20-xsl.ini
20-dom.ini       20-mysqli.ini     20-sysvmsg.ini    20-zip.ini
20-exif.ini      20-pdo_mysql.ini  20-sysvsem.ini

IDE sees all files, except 20-xdebug.ini 

PHP version: 7.2.7-0ubuntu0.18.04.2


PHP CLI: /usr/bin/php7.2 PHP CGI: Not Installed (php-cgi sapi is necessary to use built-in web server)


Loaded Configuration File: /etc/php/7.2/cli/php.ini


Additional .ini files parsed: /etc/php/7.2/cli/conf.d/10-mysqlnd.ini

/etc/php/7.2/cli/conf.d/10-opcache.ini /etc/php/7.2/cli/conf.d/10-pdo.ini

/etc/php/7.2/cli/conf.d/15-xml.ini /etc/php/7.2/cli/conf.d/20-calendar.ini

/etc/php/7.2/cli/conf.d/20-ctype.ini /etc/php/7.2/cli/conf.d/20-curl.ini

/etc/php/7.2/cli/conf.d/20-dom.ini /etc/php/7.2/cli/conf.d/20-exif.ini

/etc/php/7.2/cli/conf.d/20-fileinfo.ini /etc/php/7.2/cli/conf.d/20-ftp.ini

/etc/php/7.2/cli/conf.d/20-gettext.ini /etc/php/7.2/cli/conf.d/20-grpc.ini

/etc/php/7.2/cli/conf.d/20-iconv.ini /etc/php/7.2/cli/conf.d/20-json.ini

/etc/php/7.2/cli/conf.d/20-mbstring.ini /etc/php/7.2/cli/conf.d/20-mysqli.ini

/etc/php/7.2/cli/conf.d/20-pdo_mysql.ini /etc/php/7.2/cli/conf.d/20-phar.ini

/etc/php/7.2/cli/conf.d/20-posix.ini /etc/php/7.2/cli/conf.d/20-protobuf.ini

/etc/php/7.2/cli/conf.d/20-readline.ini /etc/php/7.2/cli/conf.d/20-shmop.ini

/etc/php/7.2/cli/conf.d/20-simplexml.ini /etc/php/7.2/cli/conf.d/20-sockets.ini

/etc/php/7.2/cli/conf.d/20-sysvmsg.ini /etc/php/7.2/cli/conf.d/20-sysvsem.ini

/etc/php/7.2/cli/conf.d/20-sysvshm.ini /etc/php/7.2/cli/conf.d/20-tokenizer.ini

/etc/php/7.2/cli/conf.d/20-wddx.ini /etc/php/7.2/cli/conf.d/20-xmlreader.ini

/etc/php/7.2/cli/conf.d/20-xmlwriter.ini /etc/php/7.2/cli/conf.d/20-xsl.ini

/etc/php/7.2/cli/conf.d/20-zip.ini

Debugger extension: Not Found

5 comments
Comment actions Permalink

Hi there,

Try with Debugger extension" field empty.

 

Based on what you have provided (your "docker exec -it docker_webapp_1 php -v") you do not need to provide anything there since you have xdebug loaded by default. Right now it might be trying  to load it for the 2nd time. Double check the help page to see what that field does and when it can be used.

 

As to why xdebug config file is not listed as loaded -- no clue.

1
Comment actions Permalink

It's not the IDE that cannot see the extension - I am sure that if you will run that command (docker://docker_webapp:latest/php -dzend... etc), result will be the same.

Are permissions for 20-xdebug.ini file same when compared to others?
Is path to xdebug.so correct? Are permissions of xdebug.so fine as well?

0
Comment actions Permalink

Getting a similar issue. CLI and FPM report xdebug as installed. But setting up Docker interpreter fails to pick up the xdebug configuration file for some reason

IDE. Configuration file value:

/usr/local/etc/php/conf.d/docker-php-ext-intl.ini
/usr/local/etc/php/conf.d/docker-php-ext-ldap.ini,
/usr/local/etc/php/conf.d/docker-php-ext-mcrypt.ini,
/usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini,
/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini,
/usr/local/etc/php/conf.d/docker-php-ext-soap.ini,
/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini,
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini,
/usr/local/etc/php/conf.d/newrelic.ini,
/usr/local/etc/php/conf.d/opcache.ini

Permissions

-rw-r--r-- 1 root staff    20 Mar 27 01:23 docker-php-ext-sodium.ini
-rw-r--r-- 1 root root 4467 Apr 2 15:36 opcache.ini
-rw-r--r-- 1 root staff 20 Apr 2 15:37 docker-php-ext-mcrypt.ini
-rw-r--r-- 1 root staff 18 Apr 2 15:37 docker-php-ext-ldap.ini
-rw-r--r-- 1 root staff 23 Apr 2 15:37 docker-php-ext-pdo_mysql.ini
-rw-r--r-- 1 root staff 20 Apr 2 15:38 docker-php-ext-mysqli.ini
-rw-r--r-- 1 root staff 18 Apr 2 15:38 docker-php-ext-intl.ini
-rw-r--r-- 1 root staff 82 Apr 2 15:39 docker-php-ext-opcache.ini
-rw-r--r-- 1 root staff 17 Apr 2 15:39 docker-php-ext-zip.ini
-rw-r--r-- 1 root staff 18 Apr 2 15:39 docker-php-ext-soap.ini
-rw-r--r-- 1 root root 1351 Apr 26 09:16 xdebug.ini
-rw-r--r-- 1 root staff 36900 Apr 26 09:17 newrelic.ini

Module permissions

-rwxr-xr-x 1 root staff   80296 Mar 27 01:22 sodium.so
-rw-r--r-- 1 root staff 179552 Apr 2 15:37 mcrypt.so
-rwxr-xr-x 1 root staff 104696 Apr 2 15:37 ldap.so
-rwxr-xr-x 1 root staff 37800 Apr 2 15:37 pdo_mysql.so
-rwxr-xr-x 1 root staff 170520 Apr 2 15:38 mysqli.so
-rwxr-xr-x 1 root staff 1666168 Apr 2 15:38 intl.so
-rwxr-xr-x 1 root staff 549200 Apr 2 15:39 opcache.so
-rwxr-xr-x 1 root staff 78920 Apr 2 15:39 zip.so
-rwxr-xr-x 1 root staff 66896 Apr 2 15:39 xml.so
-rwxr-xr-x 1 root staff 340472 Apr 2 15:39 soap.so
-rw-r--r-- 1 root staff 1630680 Apr 2 15:40 xdebug.so
lrwxrwxrwx 1 root staff 54 Apr 2 15:40 newrelic.so
0
Comment actions Permalink

@Carlton Dickson

My only guess: different owner for xdebug.ini. Try changing it to the same as other extension configs: "staff" instead of "root".

0
Comment actions Permalink

Our Dockerfile previously used something like this to install xdebug

RUN pecl install xdebug \
&& echo >> /usr/local/etc/php/config/xdebug.ini \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" >> /usr/local/etc/php/config/xdebug.ini

Changed it to the following and the IDE was able to validate xdebug was installed

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

# -rw-r--r-- 1 root staff 81 Apr 26 10:50 docker-php-ext-xdebug.ini

Hopefully this helps others with similar issues.

Probably outside the scope of this topic but is there a preferred way to install xdebug from the base php image?

0

Please sign in to leave a comment.