2

I'm trying to setup PhpStorm to debug correctly within a Vagrant Homestead environment. Xdebug is correctly installed and I'm running PHP 7.1

After setting a breakpoint in my app the script passes through any breakpoints and I get this message:

debug session was finished without being paused
        It may be caused by path mappings misconfiguration or not synchronized local and remote projects.
        To figure out the problem check path mappings configuration for 'wedleague.loc' server at PHP|Servers or enable Break at first line in PHP scripts option (from Run menu).

I've checked the mappings and have this set up for the root of the project:

local path                              remote path
file://C:/vagrant/projects/wedleague    /home/vagrant/code/wedleague

If I set to debug at first breakpoint I can work through the debug session.

Tried loads of answers here but nothing seems to work.

What can I try to get the debug session to work correctly?

Update: I've also tried this mapping (as suggested)

file://C:/vagrant/projects/wedleague/public /home/vagrant/code/wedleague/public

Still not working with this configuration either :(

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Ray
  • 3,018
  • 8
  • 50
  • 91
  • 1) Please provide some screenshots with your settings. 2) Where do you put breakpoints (what kind of file/lines)? 3) Will it work if you place `xdebug_break();` in that file on that line? 4) *"If I set to debug at first breakpoint I can work through the debug session."* Huh? Can you please explain this part. – LazyOne Jul 10 '17 at 18:51

1 Answers1

4

Step 1

Install PHPStorm 2017.X

Install Xdebug helper for chrome

Step 2

Via ssh (choose a tool like putty, WinSCP, MobaXterm etc.) Install xdebug, in your case laravel gets Ubuntu 16.04 by default with Nginx so we need to follow these instructions The values I used are

; Enable xdebug extension module
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.remote_host=10.0.2.2

in /etc/php.d/xdebug.ini

But note that I use my own vagrant installation (homestead is based on Vagrant) with CentOS and apache instead. Restart your virtual machine after config changes.

vagrant / homestead halt

and start again

vagrant / homestead up

Step 3

Config Xdebug helper extension in chrome by right clicking the symbol > options and set your IDE key to PHPStorm in the dropdown menu.

Configure PHPStorm, like a lot

hint: Settings has the shortcut ctrl + alt + s

Check the following settings. Don't forget to add both http and https in the Servers Setting and most important, don't read over the path mappings part. enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

And last but not least click these buttons, the first button with the phone horn actually has reversed icons in my opinion: when debugging it should have the little green part, altough logically red would mean stop, now it means start.

enter image description here

button 2 starts your url with a session var in the query string!

P.s. from your question: I think you need to go 1 level up root of laravel instead of public folders

edit: I just installed homestead at home and it comes with xdebug installed: enter image description here

online Thomas
  • 8,864
  • 6
  • 44
  • 85
  • Ok - had that originally and wasnt working so added the root as above. I've now added it back as you suggested but still not working – Ray Jul 10 '17 at 18:28
  • 1
    That'll be brilliant - thank you. Followed quite a few guides on setting up but this error doesnt seem to be covered much. Thanks – Ray Jul 10 '17 at 18:50
  • 1
    Thank you. I'll get back on the machine at give your steps a try. Great post – Ray Jul 11 '17 at 18:45
  • 1
    Hi - SUCCESS!!!! AFter checking the xdebug was installed correctly - I did a complete machine reboot - before I had only restarted FPM. First attempt after restart and it works! Thank you - and great post – Ray Jul 14 '17 at 08:24