Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Foxandxss's avatar

Homestead location for remote PHP (PHPStorm)

So I was working with "raw" vagrant in the past, so in PHPStorm I put ~/programming/vagrant (which is the directory where my vagrant relies) as a remote PHP and it worked nicely.

With Homestead 2, it creates ~/.homestead with the yaml file but it seems to not be the folder where the vagrant itself relies. My vagrant manager shows to me a Homestead machine which is halted (even when I have my homestead running) and digging a little bit I discovered that that points to ~/.composer/vendor/laravel/homestead which seems to be a template (there is no machine created there).

So. where lies my installation of homestead so I can create a remote PHP?

0 likes
13 replies
camiant's avatar

I've set /home/myusername/.composer/vendor/laravel/homestead as Vagrant path in PhpStorm :)

Foxandxss's avatar

But that is no machine and when I try to add that, that says to run the vagrant on it (that would create yet another machine).

camiant's avatar

Remove all of your boxes (after saving data... which would be removed) and create a new one launching "homestead up" anywhere in your machine.

This will create a VM located in

/home/myusername/.composer/vendor/laravel/homestead

using config files located in

/home/myusername/.homestead

As to PhpStorm vagrant you may refer to the first path.

Foxandxss's avatar

And that is what I did when I created it, but there is the thing:

$ vagrant global-status
d635fcf default virtualbox poweroff /Users/jesus/.composer/vendor/laravel/homestead

And then on that folder there is a "supposed" machine (not created it says) and if I try to create it, I get a There is a machine called homestead already.

You can see on the global-status that the machine is poweroff but it is still on and working.

I would open an issue, but they don't allow it :P

Foxandxss's avatar

Also happens the other way around.

If I delete my box (homestead destroy) and I go to /Users/jesus/.composer/vendor/laravel/homestead and I do a vagrant up, it creates a machine (taking in mind my ~/.homestead config) but then I can't use the homestead cli anymore because if I try to homestead up there, it tries to create a new machine but hey, there is one already. homestead status says that there is no machine yet.

So for me, /Users/jesus/.composer/vendor/laravel/homestead is like a template to generate machines but not the machine itself but then global-status says that is a machine.

I need to get some sleep, bbl :P

camiant's avatar

Ignore that homestead status says there is no machine yet, because your machine is active instead. Latest homestead 2.0.8 it's not working so well... waiting for homestead 2.0.9 release to fix some bugs.

As to vagrant global-status, it's faulty too. It reports running also for no-more-existing VMs.

Use Oracle VM VirtualBox GUI to get reliable info.

Foxandxss's avatar

Yeah, but still a bug. I have two options:

Forget about homestead cli at all and create a machine at /Users/jesus/.composer/vendor/laravel/homestead to be able to do PHPStorm debug, or create the machine with the CLI and forget about PHPStorm debug :P

I need to fill a bug.

camiant's avatar

released (and installed 2.0.9) but old issues are still there...

MegaWubs's avatar

You can also connect using the SSH Credentials instead of Vagrant. In PHPStorm, add a new interperter, give it the name Homestead an click the option SSH Credentials. In the Host field, you type 127.0.0.1 The username is vagrant and the password is also vagrant. Click Save Password and test the connection. You might get an error that the identification changed, accept it and test the connection again. This should succeed. Also refresh the php installation. Click apply and ok and you are set!

5 likes
MichaelHermeth's avatar

I dont know if anyone cares about this, but I run into exact the same problem and as a solution (or even better a workaround) I have copied these files (btw. I'm on windows):

C:\Users\Michael\AppData\Roaming\Composer\vendor\laravel\homestead\scripts\*.*
C:\Users\Michael\AppData\Roaming\Composer\vendor\laravel\homestead\src\*.*
C:\Users\Michael\AppData\Roaming\Composer\vendor\laravel\homestead\homestead
C:\Users\Michael\AppData\Roaming\Composer\vendor\laravel\homestead\init.sh
C:\Users\Michael\AppData\Roaming\Composer\vendor\laravel\homestead\Vagrantfile

to

C:\Users\Michael\.homestead

and in PHPStorm set instance folder to:

C:\Users\Michael\.homestead

and now all works fine for me with PHPStorm (ssh, up, halt, etc.), homestead (up, halt, etc. also status) and vagrant itself.

Quite possible that it also works if you only copy the Vagrantfile, I have not tested it.

1 like
justinmoh's avatar

There are at least three items I'd like to set up in PhpStorm for Laravel development:

  • Remote PHP interpreter
  • SSH
  • Xdebug

I followed the homestead setup from Laracast Series "Laravel 5 fundamentals". But now I stuck somewhere while setting up "Vagrant".

I'm thinking Homestead is like a variant of Vagrant that designed to work with Laravel. So homestead up is actually vagrant up, just wrapped with some other things altogether.

In PhpStorm, to setup Homestead = to setup Vagrant.

So I went to Preferences > Tools > Vagrant and set Vagrant Executable : ~/.composer/vendor/laravel/homestead/homestead This should be fine because this homestead is actually a vagrant as well.

For instance folder, it should be where the Vagrantfile was created for the project. In this case, ~/.composer/vendor/laravel/homestead/ as well.

After these I went to Configure PHP remote interpreter and set its vagrant instance path to be the same.

I get the error Can't Get Vagrant Settings [37:41m..... Command "ssh-config" is not defined...

Since homestead doesn't have ssh-config like vagrant ssh-config, the error is reasonable. How do you guys actually solve this?

cyclops's avatar

The default homestead box is working on 192.168.10.10 which is in the Homestead.yaml file. So I did not make the vagrant solution for homestead instead I configured it as a Remote Php Interpriter with SSH Credentials. So here is the configuration:

Host: 192.168.10.10
User name: vagrant
Password: vagrant

Even I filled the password I think Php Strom used my private key to connect the vagrant.

1 like

Please or to participate in this conversation.