Xdebug for XAMPP on OS X

After discovering how nice the vscode-php-debug extension works in Visual Studio Code on my Windows 10 laptop, I wanted this same setup for a PHP project on my work Mac Book Pro running OS X Yosemite (10.10). The version of XAMPP I currently have installed on the Mac is 5.6.11-0 and for this tutorial, there are a few requirements to consider:


Use homebrew to install the autoconf utility for producing configure scripts.

# install autoconf
$ brew install autoconf


XAMPP comes with phpize which we will want to utilize to prepare the build environment for the Xdebug PHP extension. If another version of phpize is installed, it will need to be renamed. Check to see if phpize is installed in /usr/bin:

$ cd /usr/bin
$ ls -al | grep phpize
-rwxr-xr-x     1 root   wheel      4508 Sep  9  2014 phpize

If the grep search returns phpize, similar to what is shown above, then rename it to phpize_bak.

# rename / backup phpize
$ sudo mv phpize phpize_bak

Create a new symbolic link in /usr/bin to target the XAMPP version of phpize.

# navigate to the /usr/bin directory
$ cd /usr/bin

# create symbolic link to XAMPP phpize
$ sudo ln -s /Applications/XAMPP/bin/phpize-5.6.11 phpize

# check phpize version
$ cd /
$ phpize -v
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226

phpize -v command output should be similar to what is shown above.

Xdebug Installation

Open the XAMPP phpinfo.php file in a web browser, for example, http://localhost/dashboard/phpinfo.php. In another browser window or tab, open https://xdebug.org/wizard.php and copy the phpinfo page content in the first window or tab and paste it into the textbox on the xdebug.org page. Then submit for analysis to determine the Xdebug source to download. The response should be a Summary and Tailored Installation Instructions.

Example Summary
  • Xdebug installed: no
  • Server API: Apache 2.0 Handler
  • Windows: no
  • Zend Server: no
  • PHP Version: 5.6.11
  • Zend API nr: 220131226
  • PHP API nr: 20131226
  • Debug Build: no
  • Thread Safe Build: no
  • Configuration File Path: /Applications/XAMPP/xamppfiles/etc
  • Configuration File: /Applications/XAMPP/xamppfiles/etc/php.ini
  • Extensions directory: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226
Example Instructions
  1. Download xdebug-2.4.0.tgz

You can follow the Tailored Installation Instructions from xdebug.org or you can follow the instructions here that I have found to work well.

  1. Unpack the downloaded file
    # navigate to the downloaded file
    $ cd ~/Downloads
    $ tar -xvzf xdebug-2.4.0.tgz
    $ cd xdebug-2.4.0
  2. run phpize
    $ phpize
    # example output
    Configuring for:
    PHP Api Version:         20131106
    Zend Module Api No:      20131226
    Zend Extension Api No:   220131226
  3. Configure with XAMPP php-config.
    $ ./configure --enable-xdebug --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config
  4. run make
    $ make
  5. In the Tailored Installation Instructions from xdebug.org, locate the step after make that contains the cp command and paths for copying the xdebug.so extension file into XAMPP, for example,
    $ cp modules/xdebug.so /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226
  6. Edit /Applications/XAMPP/xamppfiles/etc/php.ini
    After “;zend_extension”
    Add the zend_extension setting from the xdebug.org instructions, for example:
  7. Additionally, add these xdebug configuration settings in php.ini after the zend_extension setting:
    xdebug.remote_autostart = 1
    ; uncomment these dev environment
    ; specific settings as needed
    ;xdebug.idekey = "netbeans-xdebug"
    ;xdebug.idekey = "sublime.xdebug"
    ;some pages in your Drupal site will not work default = 100
    Optional – for development only
    Find “max_execution_time” and set to unlimited:
  8. Restart Apache using XAMPP’s manager-osx
  9. Reload http://localhost/dashboard/phpinfo.php and verify that xdebug section exists. Another verification method is to copy and paste the phpinfo into the form at https://xdebug.org/wizard.php and resubmit it for analysis.

Published by

Jim Frenette

Web Developer - views here are my own except those taken from people more clever than me.