![]() The variable XDEBUG_CONFIG is an XDebug environment variable. Of course, you need to set parameters like database name, user, password, etc. "3306:3306" # I prefer to keep the ports available for external connections in the development environment to be able to work with the database #MYSQL_RANDOM_ROOT_PASSWORD: '1' # You can use this instead of the option right above if you do not want to be able to login to MySQL under root For XDebug 2, we should use remote_host instead of client_host.Ĭommand: -default-authentication-plugin=mysql_native_password XDEBUG_CONFIG: client_host=192.168.1.2 # This is for XDebug 3. # Set the XDEBUG_CONFIG as described here: xdebug # a path to a directory containing a Dockerfile, or a URL to a git repository. ![]() Your docker-compose.yml file can look like this now: version: '3.8'ĭockerfile: Dockerfile # this line is actually redundant here - you need it only if you want to use some custom name for your DockerfileĬontext. And I often use this setup for local development. But actually, it is pretty straightforward. Please notice: If your WordPress project is located in a folder on your macOS or Windows computer and shared to an Ubuntu virtual machine using Oracle VirtualBox Guest Additions, and if your project is running inside a Docker container on that virtual machine, your Dockerfile could be a little bit more complicated. # We set this IP via XDEBUG_CONFIG environment variable in docker-compose.yml instead. This is the IP of your host machine, where your IDE is installed. # the default port for XDebug 3 is 9003, not 9000 # Also, for PhpStorm, configuration tips could be found here: ![]() Your folder files-to-copy will contain a subfolder usr/local/etc/php/conf.d/ with the file xdebug.ini: # Parameters description could be found here: The branch xdebug_3_2 of XDebug is compatible with PHP of the image wordpress:6.3.1-php8.2-apache.īut if, for example, you tried to use the image wordpress:6.1.1-php8.2-apache with the branch xdebug_3_0 of XDebug, you would get the following error while building the image:Ĭhecking Check for supported PHP versions… configure: error: not supported. 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
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |