Brew Xdebug



  1. Brew Install Xdebug Php 5.6
  2. Brew Xdebug Plus

Update: For Xdebug 3+: As of Xdebug 3, it is possible to disable the Xdebug completely by setting the option xdebug.mode to off, or by setting the environment variable XDEBUGMODE=off. It is very easy to disable Xdebug just for composer, by aliasing composer. Alias composer='XDEBUGMODE=off composer' OR.

In an earlier post I demonstrated how to install PHP5.4 using brew. Today, I required xdebug for debugging purposes and found it quite easy to install via homebrew.

Brew XdebugBrew install xdebug php 72

Install XDebug for PHP
It’s as simple as issuing the command:

  1. Homebrew have relocated “php” formulas and renamed “php71” into “php@7.1” in 2018 making it quite difficult to and also removing extensions (such as xdebug) from brew.
  2. Now, I like xdebug for development. But, this step is optional. To install xdebug for each version of php (cli and fpm) run the following. Brew link -overwrite -force php@7.2 pecl uninstall -r xdebug pecl install xdebug brew link -overwrite -force php@7.3 pecl uninstall -r xdebug pecl install xdebug.
  3. Aug 01, 2017 Xdebug allows you to break during code execution and inspect all the variables in scope during a request. This means you have all you need to troubleshoot during only one iteration of this cycle. This can save a huge amount of time when tracking down issues, and helps make your development workflow more efficient.
2
//or

To enable remote debugging, I also added these lines: