

Download & installationĭownload & installation of Xdebug is done by the following command: pecl install xdebug Configuration After following the instructions you will be able to debug your php project whether you run it on your local Apache web server or via the command line ("cli"). In this article I will explain how to install and set up Xdebug for Ubuntu (and perhaps other linux distributions) users. You can also set additional breakpoints, change the value by double clicking on a variable and go step by step through the request.Many developers are unaware of the great power that Xdebug tool adds to the process of debugging a php project. You can now view all the defined variables in your scope with the global variables like $_SERVER, $_COOKIE, $_GET and more. In this case it is the index.php in the api directory.

Here we have to select the file in which the request starts. If you now reload the website you should get a new dialog in your PhpStorm window. Now open the local website you want to debug and enable the debugging mode in the right corner of the address bar by clicking on debug in the dropdown. There should appear a red circle at the line which you clicked. You can do this by clicking on the right of the line number. Now add a breakpoint in your code which you want to debug. This will stop at every request even if you don’t set a breakpoint. It’s also a good idea to activate “Break at first line of PHP scripts”. We can now open our PhpStorm project and enable the debugging mode in “Run”, “Start Listening for PHP Debug Connections”. For this we can use Xdebug helper from the Chrome Web Store. Now we need a browser extension to enable the debug mode. Zend_extension = "C:\xampp\php\ext\php_xdebug.dll" We now need to replace this section with the following code: xdebug.profiler_output_name = "cachegrind.out.%t-%s" xdebug.profiler_output_dir = "C:\xampp\tmp" zend_extension = "C:\xampp\php\ext\php_xdebug.dll" For this we need to open our php.ini file (C:\xampp\php\php.ini)Īt the bottom of the file you should see the following commented section for the configuration of Xdebug. First let’s configure the our Php installation. Now that we’ve installed the Xdebug extension we need to configure it to work with our Php and Phpstorm installation. If you’re using a newer XAMPP version you should already have this file installed under C:\xampp\php\ext\php_xdebug.dll. You have to choose the right version for your installed php version. To start we need to download the latest Xdebug version from. With xdebug you can set breakpoints in your code, see all defined variable and even change them while running the code.
