Andre Liem

Setting up PHP xdebug with Laravel, Vagrant, and PHPStorm

In case you find yourself banging your head against the wall trying to get XDebug setup for a Laravel project running on Vagrant + PHPStorm, here’s how I get it working.

This tutorial is based off this article below from sitepoint.

I found that it was missing a few smaller details for my own setup which I’ve included below.

The (paranthesese) refers to whether you are running the commands/instructions from the actual Vagrant server, the IDE, or your own local machine.

1) Install X-Debug
(Vagrant Server)

2) Update xdebug.ini
(Vagrant Server)

add to bottom

3) Restart Server
(Vagrant Server)

or just run this from your local machine

(Local Machine)


4)Add Vagrant Server to IDE
(PHP Storm)


  • Update Name to anything
  • Host = Vagrant Machine IP
  • Use Path Mappings
  • Set File Paths
    /localmachine/path/to/root = /var/www
    /localmachine/path/to/root/public = /var/www/public

I use the Scotch Box Vagrant setup which defaults the app root to /var/www/

5) Edit Debug Config
(PHP Storm)

  • Run->Edit Configurations
  • New PHP Web Application
  • Select your Server from step 4


Wrap Up

In theory if it all worked out, you should be able to run “debug” from PHPStorm and have it load up your browser with the right url params to connect debugging together.

Leave a Reply

Your email address will not be published. Required fields are marked *