Please notice: In the Dockerfile above you need to use compatible versions of XDebug and PHP. To build on some particular version of the image. Or you can add the tag you need (like we added 6.3.1-php8.2-apache above). To build on the latest version of the image wordpress. In this Dockerfile, you can replace the first line with e.g. # works here, and we can use it to enable xdebug: # the helper script docker-php-ext-enable (defined for image `php`) # and since `wordpress`, in turn, extends the official Docker image `php`, # Since this Dockerfile extends the official Docker image `wordpress`, # Copy xdebug.ini to /usr/local/etc/php/conf.d/ # Available branches of XDebug could be seen here: # Install XDebug from source as described here: XDebug 3įor XDebug 3, the Dockerfile of the cloned project will look like this: FROM wordpress:6.3.1-php8.2-apache Please notice: The easiest way to understand all this and start working with the code is to clone this project from GitHub. XDebug 2 – the previous version of XDebug.Works both with PHP 8 and with some versions below it, e.g. XDebug 3 – the newest version of XDebug (at the time of writing).We give 2 examples of XDebug configuration below: This will clone the Git repository wpdiaries/wordpress-xdebug to the subfolder xdebug. To build an image go to the directory where your docker-compose.yml is located and clone the Git repository: git clone xdebug What if I Need to Add a PHP Extension to the WordPress Image?īefore running the examples, you would need to install Docker. 4.2.2 Adding Additional docker-compose File for Our WordPress Project.Using Multiple docker-compose Files in Development and Production Environments ![]() XDEBUG_CONFIG => remote_enable=1 remote_host= Xdebug.remote_log => no value => no value Test to see whether the values are set correctly $ docker exec -it dev php -i | | egrep "remote_enable|remote_host|remote_port|remote_log" In docker-compose.yml add the following to your environment: -%%. export XDEBUG_CONFIG="remote_enable=1 remote_host=" In your dockercontainer, put the address in the command underneath and execute it on the Docker container running PHPUnit / behat / CLI. Get the ip-address of the host running your IDE like PHPStorm. "serverName=Docker" Export $XDEBUG_CONFIG $ docker exec -it dev bash -c 'echo $PHP_IDE_CONFIG' Windows:Įxport PHP_IDE_CONFIG="serverName=Docker" Where ‘Docker’ is the name you gave to the server configured at ‘ Settings / Preferences | Languages & Frameworks | PHP | Servers’ in the step above. This variable will tell PHPStorm which server to use from its configuration for debugging. In your docker container, export the PHP_IDE_CONFIG variable. You do this by creating the server in Settings / Preferences | Languages & Frameworks | PHP | Servers. Xdebug.remote_host => => localhost Set path mappings in PHPStormįirst you need to create a server and set the path mappings for your Docker container. $ docker exec -it dev bash -lc "$VARS php -i | egrep 'xdebug.remote_host|xdebug.remote_enable'" Not working? Then check whether everything came through. ![]() $ docker exec -it dev bash -lc "$VARS vendor/bin/phpunit" $ VARS="XDEBUG_CONFIG=\"remote_enable=1 remote_host=\" PHP_IDE_CONFIG=\"serverName=Docker\"" Set the needed variables and execute your application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |