Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Include Page
Social Buttons PhpStorm
Social Buttons PhpStorm



This tutorial describes how to work with more advanced Vagrant features in PhpStorm.

Table of Contents

1. Using the built-in SSH terminal to connect to the Vagrant



PhpStorm features a built-in SSH terminal which can be used to connect to a remote machine.


From the Tools | Start SSH session... menu, we can connect to the Vagrant Boxmachine.

This will open a list of hosts we can connect to.

Our Vagrant box machine should automatically be added to this list. Clicking it will open a connection to the SSH endpoint exposed by our Vagrant boxmachine.
The Edit credentials... item allows us to provide connection information manually.


Next, we have to provide connection information. For the default lucid32 box, we can use the following values. Note that for other Vargrant Boxes this information may be different.

  • Host: localhost
  • Port: 2222 (which is forwarded to the Vagrant Boxmachine)
  • User name: vagrant
  • Password: vagrant


After we click OK, PhpStorm will connect to the Vagrant Box machine using SSH server and show us a terminal to work with.

In the SSH terminal, we can run commands remotely as well as copy/paste data back and forth.


Vagrant allows sharing folders between the host machine and the Vagrant Boxmachine. They can be used, for example, to automatically provide web root contents from the current PhpStorm project to the Apache virtual host directory on the Vagrant Boxmachine.

2.1. Add a path mapping

From the VagrantFile, we can add path mappings by adding a configuration entry for it:Image Removed

Code Block
Vagrant.configure("2") do |config|
   config.vm.synced_folder "src/", "/srv/website"

2.2. Vagrant reload

Reloading the VagrantFile can be done using the Tools | Vagrant | Reload menu. Once the Vagrant Box machine has been reloaded, a new path mapping will be available.

For example, when connecting to the Vagrant Box machine using the built-in SSH terminal, we can see the contents of the /vagrant folder which map to the PhpStorm local project folder. Be careful: deleting files from this folder will delete files on both ends!

3. Specifying Vagrant instance folder


Through the Project Settings | Vagrant, Vagrant plugins can be managed. Use the toolbar buttons to install, uninstall and update plugins. Licenses can also be installed, for example for the VMWare Fusion Provider which allows running Vagrant boxes machines on VMWare.

5. Providers support


The provider to be used has to be passed to Vagrant for every command. To make this easier and have PhpStorm automatically add the provider name to every Vagrant command, we can specify the provider through Project Settings | Vagrant. All providers installed on our machine will be available from the settings. Once selected, PhpStorm will execute all Vagrant commands using the provider configured.

6. (Re-)provisioning a Vagrant



A Vagrantfile (the Vagrant configuration file) can contain a series of provisioners that can launch installation and configuration routines once a virtual machine is running. The Provision command invokes the configured provisioners on an already running Vagrant boxmachine, without having to first destroy the virtual machine.


Once set, we can make use of them in our Vagrantfile using the #{ENV['name_of_variable']} syntax:

8. Remote PHP Interpreters

The Vagrant virtual machine's PHP interpreter can be used as a remote PHP interpreter in PhpStorm. This lets us run our application and PHP-based tools on a production-like environment (our Vagrant machine), for example for running PHPUnit tests on the Vagrant machine. We can install only PhpStorm on our development machine, and run, debug and test our application on the Vagrant machine.


Include Page
Social Buttons PhpStorm
Social Buttons PhpStorm