Search code examples
phplaravelphpstormxdebughomestead

Homestead 5, Xdebug, PHP 7, and PhpStorm


I am trying to use Xdebug in PhpStorm with a Homestead 5.0 Vagrant box using PHP 7.0. I am using macOS Sierra.

My problem:

PhpStorm can not find the Xdebug debugger in the PHP interpreters dialog box. It says "Debugger: Not installed".

enter image description here

Things I have done:

In /etc/php/7.0/fpm/conf.d, my 20-xdebug.ini has the following code:

zend_extension=xdebug.so

xdebug.remote_enable=1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
xdebug.max_nesting_level = 250
xdebug.remote_autostart=1

I have restarted the php7.0-fpm using sudo service php7.0-fpm restart.

I have read from other community forums that Xdebug comes installed on Homestead 5. However, when I run php -m | grep xdebug the xdebug extension is not listed. Yet, when I run phpinfo() xdebug is listed.

I have ensured that my IDE is using port 9000, my IDE key is 'vagrant' in both places.

Thank you for the help!

Additional screenshots: enter image description here


Solution

  • I was able to get XDebug working a few weeks ago with the latest version of Homestead as of writing this on 2017-05-13. PhpStorm will not detect my XDebug extension in the GUI. That was where the break-down was occurring in my attempts to get things up and running after a fresh install of Homestead was created.

    However, after installing XDebug in my VM, setting up the xdebug php extension file, and configuring everything back to how it would have normally functioned, it worked on my first (re)attempt at debugging.

    This guide is how I originally learned how to set up the configurations in PhpStorm. It does not discuss setting an ide-key and some other small things, but most of which are easily discoverable.