In the case where you want to link PHPStorm and xdebug on docker, "Why can't I connect ?!" I will write it as a hint.
Xdebug is a powerful PHP debugging tool. It makes the familiar "var_dump" easier to see in PHP debugging, finds the bottom-necked process, and allows you to step through it. Another debugging tool is Zend Debugger. 5 tips to use Xdebug | Create a smartphone site app. Than.
Let's add settings to xdebug.ini and php.ini. After adding it, you need to restart nginx and apache.
xdebug.remote_log=/tmp/xdebug.log
The log will be displayed in /tmp/xdebug.log. Let's identify the cause by looking at the output error content. If you google, related information will come out. Trying to communicate without looking at the logs is like entering a mountain without a map.
If xdebug does not work even if you describe the xdebug settings, and there is no log Let's check if the settings are loaded in php. xdebug is not working because I forgot to load xdebug.so, It is possible that the settings were overwritten in another file.
The following command outputs the setting value loaded in php. If xdebug is enabled, some xdebug related settings will be output.
php -r 'phpinfo();' | grep xdebug
The part of | grep x debug
is narrowed down.
You need to set the mapping between the file path on docker and the file path on your local PC.
Let's put a breakpoint where it always runs when accessed from a browser.
In laravel, it is public / index.php
.
Now you can isolate the cause, whether xdebug isn't working or the breakpoint is added in the wrong place.
I hope you find this helpful.
https://qiita.com/haruna-nagayoshi/items/99fa041e884c2c3975d2 https://qiita.com/castaneai/items/d5fdf577a348012ed8af https://qiita.com/taniai-lvgs/items/8e9eba112d2d0ed2530f
Recommended Posts