3
votes

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

1
make sure you are using the php interpreter you think you are. remember, apache/httpd uses a completely different one to cli. does phpinfo() confirm the settings youre expecting? - DevDonkey
I have used /usr/bin/php -m to verify that xdebug is not listed. - Matt McAlister
yes, hence the problem. Youre checking the cli install of php, not the php module that apache is using. There will be another php.ini file somewhere. - DevDonkey
Ah, I see what you mean. I have run phpinfo() and found that Xdebug version 2.4.0 is installed. Yet the PhpStorm interpreter is still not detecting it. - Matt McAlister
Just get phpinfo() output via browser -- the top table will list the config files used. 100% that it will be different one to the one you see on your screenshot (which is for CLI environment). PHP Interpreters work in CLI environment -- which could be (it is in your case) different to what your Apache/nginx/etc is using. If you will be debugging via browser (web pages) then you should not look at what PHP Interpreter shows - LazyOne

1 Answers

0
votes

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.