
- #VAGRANT HOMESTEAD XDEBUG PHPSTORM HOW TO#
- #VAGRANT HOMESTEAD XDEBUG PHPSTORM INSTALL#
- #VAGRANT HOMESTEAD XDEBUG PHPSTORM CODE#
- #VAGRANT HOMESTEAD XDEBUG PHPSTORM WINDOWS#
It didn't take long for me to understand what stepping in and stepping out of functions did etc. windows10PhpStome v2019.1.3homestead v7.2 (ubuntu18.04)laravel 5.8. I learned the different debugging actions by just playing around with the debugger and watching this PHPStorm Webinar. Now, whenever you want to debug something all you have to do is start listening in PHPStorm and ensure that the Xdebug helper extension in chrome is set to Debug. On my computer, my project root is H:\Accescape but I need to let PHPStorm know where the root is on the server which are set to /home/vagrant/Accescape. Click to set up the path mappings which should reflect what you have in your homestead.yaml file for folders. Lastly, the debug window will indicate there is an error with the path mappings.
#VAGRANT HOMESTEAD XDEBUG PHPSTORM CODE#
The first time you debug, PHPStorm will alert you with the dialogue Incoming Connection from Xdebug.Ĭhoose the root folder of your project and accept. PhpStorm Homestead (or any other Vagrant VM) Xdebug extension In the code examples please change paths according to your php version, I am using php 7.2. The debugging window should pop up in PHPStorm automatically.

Refresh in Chrome to initiate the debugging. Navigate to Run>Start Listening for PHP Debug Connections. You can set a breakpoint (red dot) by clicking in the column just to the right of line numbers. Open PHPStorm and set a breakpoint in your routes file for the route that you are currently viewing in Chrome. Set the extension to debug by clicking its icon in the Chrome address bar. Under the Xdebug helper's options, choose PHPStorm for the IDE key.
#VAGRANT HOMESTEAD XDEBUG PHPSTORM INSTALL#
Install the Chrome Xdebug helper extension. In the terminal, sudo service php5-fpm restart
#VAGRANT HOMESTEAD XDEBUG PHPSTORM WINDOWS#
To close and save the file, on Windows I do: Ctrl+x followed by y for yes and enter. In the terminal, sudo nano /etc/php5/fpm/conf.d/20-xdebug.ini Navigate to Tools>Start SSH Session and choose your vagrant host (PHPStorm automatically adds this) I'm going to assume you have installed PHPStorm and Homestead. Here's a step-by-step process that I used to get PHPStorm + Homestead + Xdebug working in harmony. I recently installed Homestead for my development environment and discovered Xdebug needed some additional settings before it would work.
#VAGRANT HOMESTEAD XDEBUG PHPSTORM HOW TO#
So we need some way to tell it how to map these things.Ĭlick on OK, then choose this newly created server config from the Server: dropdown menu in the Run/Debug Configurations settings, then click on OK.Full thanks to Lewis on laracasts for this! While this may seem a little strange, remember that PhpStorm is reading files from your local machine, but letting you run and debug them in a “remote” server on our Vagrant box. Click Fill from Vagrant config, select the location of your Vagrantfile, say wow and click Test connection. In the top left click the + icon and select Remote. For instance, for plugin development, the seomatic plugin is a symlink to it’s actual location elsewhere in my dev machine, so we need to add a mapping for that, too. Configuring PhpStorm Setting up the default php interpreter: In PhpStorm’s settings page select PHP, choose a version and click the ellipsis on the right to set an interpreter. We need to add a mapping for the root project, as well as anything else that is symlinked. For instance, my project root on my local machine is /Users/andrew/webdev/sites/craft3 but it needs to be mapped to the absolute path /home/vagrant/sites/craft3 on the remote server (our Vagrant box).

Now we need to tell PhpStorm where our local files are on the server. Check the Use path mappings (select if the server is remote or symlinks are used) checkbox.
