WordPress Dev Environment: Xdebug

One essential process in development is debugging. One tool which can help this process tremendously is Xdebug which allow us to add breakpoints in codes and see what variables are passing and the contents of the variables when the application running. This allows us to debug the codes if we see mistakes in the variables.

To use Xdebug we need to integrate it with the local server. For Windows, there are binaries which can be installed directly to the PHP extension. For Mac, we need to take a bit more steps.

To install Xdebug make sure that you have installed the CLI make tools (https://developer.apple.com/xcode/). Also, make sure you can run phpize from your XAMPP in the terminal. If you cannot run it then add the following line to .bash_profile file in your home directory ( if you don’t have it just create it yourself).

export PATH=/Applications/XAMPP/xamppfiles/bin:$PATH

First, let’s open the PHP information that we used as a local server. You can open it from PHPInfo link in XAMPP dashboard. Select all the page (CMD + A) and copy it. We need to do this to get a personalised installation from Xdebug page.

Then open https://xdebug.org/wizard.php and paste the PHPInfo you copied before in here, then analyse the PHP information.

Xdebug Tailored Installation Instructions
Xdebug Tailored Installation Instructions

You will get a personalised installation step such as this.

Xdebug Tailored Installation Instructions Steps

Just follow the steps explained in the page and Xdebug will be enabled in your server. To check this open PHPInfo from XAMPP dashboard and search for Xdebug.

3 thoughts on “WordPress Dev Environment: Xdebug”

  1. Pingback: WordPress Dev Environment: VSCode – Code Completion and Debugging – WP Dev Notes

  2. Pingback: WordPress Debugging Example – WP Dev Notes

  3. Pingback: WordPress Plugin Performance: Profiling using Xdebug and Webgrind – WP Dev Notes

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.