

Indeed, from the point of view of Xdebug, the PHP application runs in the "/var/this point, you should be able to put a breakpoint in your code, start a debugging session and get the application to stop on the breakpoint. (8) Don't forget to click on Use path mappings (7) Add your host on port 80 using Xdebug (5) Once it's done, you are on debug server page. (2) Confirm it by clicking on PHP Web Page Registering your container server in PHPStormįirst, click on edit configurations, on the top right of PHPStorm window. Otherwise, just keep the default configuration port. If you want to use another port for Xdebug, follow the instructions below. This directly conflicts with the XDebug port. In particular, if you are using PHP-FPM, the default port for PHP-FPM is 9000. except if port 9000 is already taken by another program on your host (your machine running PHPStorm). Out of the box, everything should be fine. Our PHP container has Xdebug installed and Xdebug will try to connect to PHPStorm on port 9000 by default. Keep in mind that PHPStorm opens port 9000 (by default) so Xdebug can connect to it. It automatically configures Xdebug for the container. Note: the PHP_EXTENSION_XDEBUG environment variable is specific to the thecodingmachine/php. Image: thecodingmachine/php:7.2-v1-apache My base docker-compose.yml file looks like this: app: If you are starting a project, I recommend you to download one of our images here TheCodingMachine Docker PHP images In my example, I will use a Docker image of TheCodingMachine created by David Négrier. With Zend OPcache v8.1.To follow this tutorial, you must have the Xdebug extension installed on your container. With Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans Zend Engine v4.1.8, Copyright (c) Zend Technologies Install ok: channel:///xdebug-3.1.5Ī quick test shows that all is now as it should ~ $ php -v

So to fix, I created the directory and installed Xdebug again: Investigating, I found that /opt/homebrew/Cellar/php/8.1.8/pecl is a symlink to /opt/homebrew/lib/php/pecl, however, this directory doesn’t exist. PHP Warning: mkdir(): File exists in /opt/homebrew/Cellar/php/8.1.8/share/php/pear/System.php on line 294ĮRROR: failed to mkdir /opt/homebrew/Cellar/php/8.1.8/pecl/20210902 Starting to download xdebug-3.1.5.tgz (232,070 bytes) This whirrs and clicks for a while downloading and compiling the xdebug.so and then fails ~ $ pecl install xdebug Homebrew is always up to date, so it installed PHP 8.1 for me.Īgain, as usual, I installed Xdebug using pecl install xdebug.

I have recently set up a new M2 MacBook Air and as usual, installed Homebrew and then installed PHP.
