Skip to content

Instantly share code, notes, and snippets.

@devdrops
Created May 19, 2016 13:30
Show Gist options
  • Select an option

  • Save devdrops/ac06a017875f86d6ad9919b69cd7294f to your computer and use it in GitHub Desktop.

Select an option

Save devdrops/ac06a017875f86d6ad9919b69cd7294f to your computer and use it in GitHub Desktop.
CONFIGURE XDEBUG ON VAGRANT BOX

CONFIGURE XDEBUG ON VAGRANT BOX

Tired of editing config files every goddam time after vagrant destroy? I've got you covered :D

  1. Find where the xdebug.so file is. Store this value in a variable.

    EXT_PATH=$(sudo find / -name xdebug.so)
  2. Edit the given files (where {EXT_PATH} is the value stored on 1.):

    • Replace all contents from /etc/php5/mods-available/xdebug.ini with:

       zend_extension={EXT_PATH}
       xdebug.default_enable=1
       xdebug.remote_enable=1
       xdebug.remote_connect_back=on
       xdebug.remote_port=9000
       xdebug.remote_autostart=0
       xdebug.remote_log=/tmp/php5-xdebug.log
       xdebug.idekey=netbeans-xdebug
      
      • Optional: allow the user to define which is the idekey through an external variable file.
    • At the end of /etc/php5/cli/php.ini and /etc/php5/fpm/php.ini, add the following lines:

       [xdebug]
       zend_extension="{EXT_PATH}"
       xdebug.remote_enable=1
       xdebug.remote_host=localhost
       xdebug.max_nesting_level=1000
      
  3. Restart PHP and HTTP server.

  4. PROFIT!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment