next to the Servers field to create a new server.Ĭreate a Server Configuration for the PHP Docker container, configure Xdebug as the debugger and the path mapping that fits the folder structure within the PHP container It’s only important that you remember this key because we will use it later for the request to trigger the debugging.Ĭlick on the three dots. I usually choose something like IDEA_DEBUG. To be able to select this configuration, you may need to scroll down in the type selection popup (“Add New Configuration”) and click on “52 items more (irrelevant)” in order to find the type “PHP Remote Debug”.Ĭreate a Debug Configuration in IntelliJ IDEA Ultimate/PhpStorm of the type ‘PHP Remote Debug’ which connects to our PHP Docker container via XdebugĮnter an arbitrary key for Ide key(session id). src:/var/www/html/ ports : - "80:80" Configure IntelliJ IDEA Ultimate or PhpStormĬreate a Run Configuration of the type “PHP Remote Debug”. Version : '2' services : apache_with_php : build. Afterward, we have to configure Xdebug with some properties in the php.ini. Within the Dockerfile we install and enable Xdebug using pecl and docker-php-ext-enable. Therefore, we create an own Docker image based on the PHP/Apache image. Xdebug runs within the PHP container and connects to the Xdebug server controlled by IntelliJ IDEA Ultimate/PhpStorm Install and Configure Xdebug in the PHP Docker Containerįirst of all, we need to install and activate Xdebug in our PHP container. But how can we debug the PHP code running in the container? In this post, I show you how to configure Xdebug in a PHP container and configure IntelliJ IDEA Ultimate or PhpStorm for remote debugging. Running PHP and an Apache in a Docker container is very handy for local development. Configure IntelliJ IDEA Ultimate or PhpStorm.Install and Configure Xdebug in the PHP Docker Container.Tried: :9003 (through xdebug.client_host/xdebug.Engineering Management, Java Ecosystem, Kotlin, Sociology of Software Development Debugging within a PHP Docker Container using IDEA/PhpStorm and Xdebug NOTICE: PHP message: Xdebug: Time-out connecting to debugging client, waited: 200 ms. Tried: 172.18.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-( NOTICE: PHP message: Xdebug: Could not connect to debugging client. Tried: 172.17.0.1:9003 (through xdebug.client_host/xdebug.client_port) :-(Īfter change xdebug.ini to: zend_extension=xdebug With Xdebug v3.0.3, Copyright (c) 2002-2021, by Derick RethansĪnd when I go to (with cookie XDEBUG_SESSION:"PHPSTORM") docker log says: Telnet: Unable to connect to remote host: Connection refused XDebug in DockerFile install via: RUN pecl install xdebug \Īfter docker-compose up, in container: # routeĭestination Gateway Genmask Flags Metric Ref Use Ifaceġ72.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 docker/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ~/.composer-docker/cache:/root/.composer/cache:delegated # The following lines are desirable for IPv6 capable hosts With Zend OPcache v7.4.16, Copyright (c), by Zend Technologies Zend Engine v3.4.0, Copyright (c) Zend Technologies I have few docker containers: php, nginx, mariadb, redis, adminer and try to debug some PHP code with PhpStorm and Xdebug.ĭocker-compose version 1.24.1, build 4667896bĭISTRIB_DESCRIPTION="KDE neon User Edition 5.21"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |