John Davidson

PhpStorm - PHP 5.6 - Xdebug 2.5.5 Docker

0 comments
Message:


I've be searching a days to a solution but not success. I installed Xdebug 2.5.5 in my Docker container and added it to my php.ini as follow


[xdebug]
zend_extension = "/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"

When I run php -v I got


PHP 5.6.40 (cli) (built: Jan 23 2019 00:10:05) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

But the I try to add on PhpStorm the CLI interpreter I got "Debugger: Not Installed


PHP version: 5.6.40
PHP CLI: /usr/local/bin/php PHP CGI: Not Installed (php-cgi sapi is necessary to use built-in web server)
Loaded Configuration File: Not Found
Additional .ini files parsed: /usr/local/etc/php/conf.d/docker-php-ext-calendar.ini /usr/local/etc/php/conf.d/docker-php-ext-exif.ini /usr/local/etc/php/conf.d/docker-php-ext-gettext.ini /usr/local/etc/php/conf.d/docker-php-ext-mysql.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-shmop.ini /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini /usr/local/etc/php/conf.d/docker-php-ext-sysvmsg.ini
Debugger extension: Not Found
Loaded extensions: calendar, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gettext, hash, iconv, json, libxml, mbstring, mhash, mysql, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, session, shmop, SimpleXML, sockets, SPL, sqlite3, standard, sysvmsg, tokenizer, xml, xmlreader, xmlwriter, Zend OPcache, zlib


My Answer:
/path/to/xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_host=host.docker.internal
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM

Make sure to replace /path/to/xdebug.so with the actual path to your xdebug.so file. Also, ensure that the xdebug.remote_host is set to host.docker.internal if you are using Docker for Mac or Docker for Windows. If you are using Linux, you may need to set this to the IP address of your host machine.

After making these changes, restart your PHP container and try debugging your PHP code in PhpStorm again. This should allow PhpStorm to connect to Xdebug running in your Docker container.

Rate this post

3 of 5 based on 6846 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us