For this example, we will use the docker installation as well as symfony5 written in another articles: Article Docker, Syfmony5
Creating an alias for the IP used
On MacOs, it is necessary to create an alias for the IP we use. It is common to use the IP:
The order is as follows:
sudo ifconfig lo0 alias 10.254.254.254
If you want it every time the ordinature is restarted, thanks to a @ralphschindler on github, this is very simple to do by following its article https://gist.github.com/ralphschindler/535dc5916ccbd06f53c1b0ee5a868c93
Beware, the configuration of xdebug in his article concerns version 2.
The order is as follows
sudo curl -o /Library/LaunchDaemons/com.ralphschindler.docker_10254_alias.plist https://gist.githubusercontent.com/ralphschindler/535dc5916ccbd06f53c1b0ee5a868c93/raw/com.ralphschindler.docker_10254_alias.plist
Creating the xdebug configuration file
With the arrival of version 3 of xdebug, many configurations have changed names.
In the docker-> php-fpm folder, create a xdebug file.ini
zend_extension=xdebug.so xdebug.mode=debug xdebug.start_with_request=yes xdebug.discover_client_host=off xdebug.client_host=10.254.254.254 xdebug.client_port=9005 xdebug.idekey=PHPSTORM xdebug.max_nesting_level=1500
In the Dockerfile file in the same folder, add the following command
RUN export XDEBUG_SESSION-PHPSTORM
Configuration of Phpstorm
Create a new server:
And create a new PHP remote debug with this one and indicating the key “PHPSTORM
Once this is done, you have to go into the xdebug configuration and change the port to indicate 9005 and not 9000
On firefox install the add-on xdebug helper.
Once this is done, indicated that you are using PHPSTORM in the plugin configuration