If you are stuck with the cooperation between PHPStorm and xdebug on docker. trouble shooting
What is this
In case you want to link PHPStorm and xdebug on docker, “Why you can’t connect!” I will write a hint.
What is Xdebug?
Xdebug is a sophisticated PHP debugging tool. It makes it easy to see the familiar “var_dump” in PHP debugging, finds the bottom-necked process, and step through it. Another debugging tool is Zend Debugger. 5 Tips to use Xdebug | Let’s make a smartphone site application. Than.
Add settings to xdebug.ini and php.ini. After adding, you need to restart nginx and apache.
Since the log is displayed in /tmp/xdebug.log, Let’s identify the cause by looking at the content of the output error. If you google, related information will come out. Trying to communicate without looking at the logs is like entering a mountain without a map.
Is the xdebug setting loaded in the first place?
If xdebug does not work even if the setting of xdebug is described, and no log is output, Make sure that the settings are loaded in php. xdebug is not running due to forgetting to load xdebug.so, It is possible that the settings were overwritten in another file.
The following command outputs the setting values loaded in php. If xdebug is enabled, some xdebug related settings are printed.
php -r'phpinfo();' | grep xdebug
The part of
| grep xdebug is narrowed down.
Is Path Mapping on PHPStorm set?
You need to set the mapping between the file path on docker and the file path on your local PC.
set a breakpoint in index.php
Let’s put a breakpoint where it will be executed whenever it is accessed from the browser.
If it is laravel, it is
Now you can isolate the cause of whether xdebug is not working or where the breakpoint is added.
We hope you find this helpful.