Configuring Xdebug in PhpStorm

02.03.2022 | 707 | SQL

Installing the Xdebug extension in the PhpStorm IDE and configuring it for use on the example of the installed php7.4

We put the extension:
apt install php7.4-xdebug
Open the configuration file for FPM (you may have another one):
nano /etc/php/7.4/fpm/php.ini
Add to the end of the file (first find out the path / name of the library):
[xdebug] zend_extension="/usr/lib/php/20190902/xdebug.so" xdebug.mode = develop,debug xdebug.client_host = localhost xdebug.client_port = 9003 
Restarting the web server:
systemctl restart php7.4-fpm.service
Changing the port in the PhpStorm settings:
File -> Settings -> PHP -> Debug
In the Xdebug section, we set:
Debug port: 9003

In the upper right corner of the storm, we look for and add the debug configuration "Add Debug/Run Configuration", select the type "PHP Remote Debug" specify the data of the local server "yoursite.local / 80 / PHPSTORM"

Next, we put the extension for your browser "Xdebug helper", in its settings, select the IDE Key "PHPSTORM" and enable it on the right in the browser address bar.

We turn on the tube "Start Listening for PHP Debug Connections" in the strome at the top right and put breakpoints opposite the lines in the editor.

We update the browser page and everything should work.

Source of information


← Back

Comments (0)