A Chassis extension to install and configure Xdebug on your server
Puppet HTML
Switch branches/tags
Nothing to show
Clone or download
Latest commit 7f9977c Mar 28, 2018
Permalink
Failed to load latest commit information.
.github Add issue template Jul 26, 2017
modules/xdebug Enable autostart in Xdebug Mar 28, 2018
.travis.yml Update linting Mar 12, 2018
README.md Switch to lower-res screenshots Mar 16, 2018
chassis.yaml Add Extensions V2 support Mar 12, 2018

README.md

Xdebug

A Chassis extension to install and configure Xdebug on your Chassis server.

Usage

  1. Add this extension to your extensions directory git clone git@github.com:Chassis/Xdebug.git extensions/xdebug
  2. Set your config.local.yaml PHP version to 5.6 or higher.
  3. Run vagrant provision.
  4. By default PHPSTORM is the default IDE. This can be overridden in your any of your .yaml files by adding in: ide: ATOM and replacing ATOM with your IDE of choice. If you do this then please be sure to change your IDE Key in the Xdebug Helper extension mentioned below.
  5. Configure your browser and your IDE, set a breakpoint, and happy debugging!

Browser Setup

In Chrome

  1. Install the Xdebug Helper.
  2. Go to Settings -> More Tools -> Extensions in Google Chrome.
  3. Scroll down to Xdebug helper and click Options.
  4. Select your editor in the IDE key dropdown, or select "Other" and enter a custom key if your editor is not listed e.g.
    Xdebug Helper IDE Key selection menu in Chrome
  5. Enable Xdebug Helper. e.g.
    Enable Xdebug helper in Chrome

In Firefox

  1. Install the Xdebug Helper.
  2. Go to Menu > Add Ons > Extensions in Firefox.
  3. Scroll to Xdebug helper and click Preferences.
  4. Select your editor in the IDE key dropdown, or select "Other" and enter a custom key if your editor is not listed e.g.
    Xdebug Helper IDE Key selection menu in Firefox
  5. Enable Xdebug Helper. e.g.
    Enable Xdebug helper in Firefox

Editor Setup

In PHPStorm

  1. Go to Preferences -> Languages + Frameworks -> PHP -> Servers and add a mapping for your website.
  • File/Directory should be set to chassis folder (i.e. where the Vagrantfile is in).
  • Absolute path on the server should be set to /vagrant. e.g.
    Server mapping in PHPStorm
  1. Enable Start Listening for PHP Debug Connections e.g.
    Listen For PHP Debug Connections
  2. Set a breakpoint in PhpStorm, refresh the page you with to debug in the browser, and start debugging!

VS Code

  1. Go to the VS Code Extensions manager (or enter "Install Extensions" in the command palette) and install & activate the PHP Debug extension.
  2. Go to the Debug tab in the sidebar and click the small gear icon at the top of the left column; select "PHP" from the menu that will pop up to auto-create a launch.json PHP debugging configuration file in your project
    Selecting the "configure launch.json" button in VS Code
  3. Add a "pathMappings" key to the "Listen for Xdebug" launch configuration to map the workspace root to the /vagrant directory within the virtual machine e.g.
    Configuring "pathMappings": { "/vagrant": "${workspaceRoot}" } inside VS Code launch.json file
  4. Click Start Debugging in the left column of the Debug tab e.g.
    The "Start Debugging" button in VS Code
  5. Set a breakpoint in VS Code, refresh the page you with to debug in the browser, and start debugging!

Xdebug Profiling

If you'd like to enable Xdebug Profiling you can do so by doing either of the following:

  1. Append ?XDEBUG_PROFILE=1 to a URL you'd like to profile.
  2. Add 1 to the Xdebug Helper Chrome extension.
  3. The profiling logs will be save on your Chassis VM under /tmp. You'll need to vagrant ssh then cd /tmp to view them.

Troubleshooting

If you're having issues with XDebug not working then there is a chance that port 9000 is being used by some other software on your computer. To work around this change the port number to another value. e.g. 9001 and run vagrant provision.