Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

OOTB Xdebug support for PhpStorm #94

Closed
phenaproxima opened this issue May 6, 2015 · 9 comments
Closed

OOTB Xdebug support for PhpStorm #94

phenaproxima opened this issue May 6, 2015 · 9 comments

Comments

@phenaproxima
Copy link

I'm not sure if Drupal VM already supports this, but I had to do a bit of work in order to get Xdebug talking to PhpStorm.

I had to alter my /etc/php5/apache2/conf.d/xdebug.ini as follows:

xdebug.default_enable = 1 ; Was 0
xdebug.remote_enable = true ; Was false
xdebug.remote_connect_back = true ; Was false
xdebug.remote_host = 10.0.2.2 ; Was localhost
xdebug.idekey = "vagrant" ; Was sublime

Is there any chance of having this be Drupal VM's default configuration, or somehow make it very easy to configure Xdebug this way in config.yml?

@geerlingguy
Copy link
Owner

All of these variables can easily be overridden inside your config.yml file. See https://github.com/geerlingguy/ansible-role-php-xdebug (the README) for examples of variables you can set. For example:

php_xdebug_default_enable: 1
php_xdebug_remote_enable: "true"
php_xdebug_remote_connect_back: "true"
php_xdebug_remote_host: 10.0.2.2.
php_xdebug_idekey: vagrant

@phenaproxima
Copy link
Author

Brilliant. Thank you!

@kevinquillen
Copy link

Why wouldn't xdebug just be enabled by default?

@geerlingguy
Copy link
Owner

@kevinquillen - Because Xdebug incurs a non-trival amount of overhead, and I (and many others) like to develop without it enabled most of the time, and only enable it as-needed. The two reasons for this (for me) are:

  1. Performance overhead—memory and resource usage are more like real-world when xdebug is disabled.
  2. 99% of the time, I don't need all the extra information Xdebug outputs in error logs, and don't need any extra information beyond what I can git dumping a variable by hand.

@geerlingguy
Copy link
Owner

@kevinquillen - I've updated the documentation here: http://docs.drupalvm.com/en/latest/extras/xdebug/

@kostajh
Copy link

kostajh commented Dec 14, 2015

@geerlingguy with the out of the box configuration provided by Drupal VM, have you gotten PhpStorm to debug Behat scripts running in the VM? I have a remote Behat configuration set up, and it's using Drupal VM's php binary, so I have no issues running Behat tests from within Drupal VM using PhpStorm. But debugging said configuration doesn't work.

According to this, xdebug_autostart should be 1 and connect_back should be false, these are different values than the VM provides. I've tried changing those myself within the VM, though, without success.

@geerlingguy
Copy link
Owner

@kostajh - I, personally, have not, as I don't use PhpStorm :(

But I'm guessing someone has, and hopefully you can find that person to help; did anything in the docs.drupalvm.com section on xdebug help?

@kostajh
Copy link

kostajh commented Dec 14, 2015

@geerlingguy no, unfortunately. The same would apply for Sublime Text though. (Assuming that's what you are using.) Are you able to execute a PHP script from the command line within the VM, and have Sublime Text's XDebug client connect?

@geerlingguy
Copy link
Owner

@kostajh - Last time I did was at least a few months ago, but when I did, I did it using the instructions in the docs (http://docs.drupalvm.com/en/latest/extras/xdebug/)... so something may have changed, or a port might not be open that's required... something like that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants