Information for: DEVELOPERS   PARTNERS

Using Xdebug on Acquia Dev Desktop for Windows

The instructions on this page are compatible only with versions of Dev Desktop released after January 2019.

Xdebug is a tool for debugging PHP. With it, you can do stack or function traces, memory allocation analysis, and script execution. Acquia Dev Desktop for Windows includes xdebug.dll as a part of its default installation.

Note for PHP 7 users

PHP 7 does not include the required xdebug.dll file. Download the correct version for your server here.

To use Xdebug with Acquia Dev Desktop, complete the following steps:

  1. Open the Acquia Dev Desktop Control Panel, and then click Stop in the lower right corner of the application. If the stack is already stopped, a Start button will instead be displayed—do not click the button to start the stack.

  2. From the file menu, select Acquia Dev Desktop > Preferences, and then click the Config tab.

  3. In the Default PHP version list, click your desired version of PHP. If you change the version, Acquia Dev Desktop will briefly display a dialog box stating Applying changes.

  4. In the Stack configuration files section, find the PHP field (which contains a list of php.ini files). Click the file for your selected version of PHP, and then click the Edit link to the right. Acquia Dev Desktop opens a text editor to edit the file.

  5. In the text editor, remove any existing lines in the [xdebug]section. If this section does not exist, search for the zend_extension, which will be the correct place to add the information in the following steps.

  6. Identify the [xdebug] section of your file, which contains a commented-out line beginning with ;zend_extension.

  7. Uncomment and modify the zend_extension line to add code similar to the following to the [xdebug] section of your file:

    [xdebug]
    zend_extension="C:\Program Files (x86)\DevDesktop\php7_1_x64\ext\php_xdebug.dll"
    xdebug.remote_autostart=off ; Do not run Xdebug on every page request
    xdebug.remote_enable=1
    xdebug.remote_handler=dbgp
    xdebug.remote_mode=req
    xdebug.remote_host=localhost
    xdebug.remote_port=9000
    

    Replace C:\Program Files (x86)\DevDesktop\php7_1_x64\ext\php_xdebug.dll with the location and name of the most recent xdebug.dll file to use. For example, the following example could be useful for PHP 7.1 running on 64-bit Windows 7, with Acquia Dev Desktop installed in the C:\Program Files (x86) directory:

    zend_extension="C:\Program Files (x86)\DevDesktop\php7_1_x64\ext\php_xdebug.dll"
    
  8. Save the updated .ini file.

  9. Click OK.

    Note

    You may receive a pop-up window that says Name is empty. Go to the Acquia Dev Desktop > Preferences > General tab and enter values into the Your name and Email fields.

Confirming that Xdebug is working

To confirm that Xdebug is loaded and working, complete the following steps:

  1. On the main Acquia Dev Desktop Control Panel page, click Start to start the stack.

  2. Click Settings, and then click to the Config tab. Under the Stack configuration files, find the PHP Info, and then click the link for the PHP version that you’re using and for which you edited the php.ini file.

  3. A web browser opens with the output from PHPinfo(). Search for the word Xdebug, and if you see something like this, Xdebug is enabled:

    This program makes use of the Zend Scripting Language Engine:
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPache v7.2.13, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.0, Copyright (c) 1999-2018, Derick Rethans
    

    If the preceding output does not appear, you might need to the php.ini file again.

Next steps

After you have completed the procedures on this page, you will need to configure your IDE to communicate with Xdebug. For information about how to do this, refer to your IDE’s help files or online resources.