Here are instructions on how to enable Xdebug with PHP.
-
Find out which PHP are you currently running and the
php.ini
that is loaded. -
Run
pecl install xdebug
and it should automatically install and enable it. (Ensure thepecl
is from the same installation as yourPHP
executable) -
The install above should autoenabled "xdebug.so" in y our
php.ini
file, but you still need to add another line, like this:zend_extension="xdebug.so" xdebug.mode=debug
-
Verify you have it installed by running
php -v
, and you should see line like this:with Xdebug v3.1.3, Copyright (c) 2002-2022, by Derick Rethans
-
Restart
httpd
web server if you are using thePHP
there. -
Install Xdebug Helper Chrome Extension and enable "Debug" mode.
-
Now you may reload your
PHP
application on the Chrome browser.
NOTE: After enabled these settings, you should checkout PHPStorm IDE. It has excellent debugger that let you step through your code like an Ninja!