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

jrdavidson's avatar

Homestead and Vagrant

I'm trying to figure out how to fix this issue so that when I boot up homestead it'll work correctly.

me-iMac:~ me$ homestead up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: homestead
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 (guest) => 8000 (host) (adapter 1)
    default: 443 (guest) => 44300 (host) (adapter 1)
    default: 3306 (guest) => 33060 (host) (adapter 1)
    default: 5432 (guest) => 54320 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 5.0.6
    default: VirtualBox Version: 4.3
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/me/.composer/vendor/laravel/homestead
    default: /home/vagrant/Projects => /Users/me/Projects
==> default: Running provisioner: file...
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCbsSW5WDRuOUmFopXlql7N/XOvTvBF/3Jsezchr9789gVuW4NzOLveKO/GbaeojqGxpHTlbuOMz6GTIHtCfWvjX+i5sOQr5XXDQXLxo8iLGg2wkFbxhkcKAjJ0oiW4mm5DIhk4YpKbrrxsuYMasxC7q9kieE31F9E1jbQiK1cyLe45OGFvae3UYT5nZYC5uAHyab3G71Pb/OfTb06jFTEJL5AhSWXfk9Dc88poOkmeJc/w0LsOm8KS2hWpN5cDudUWazmfqqzYYN257q27za4LDSGHBWyGA6X4KQ08l+fjelTCPNGDpOMnM5Rbi6dKMaoiGZ/Gq6ariIHTo4DpjYT you@homestead
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: Running provisioner: shell...
    default: Running: /var/folders/2b/cvfyxj957y9gffm3xjsgm8640000gn/T/vagrant-shell20151227-4111-ejy31g.sh
==> default: Running provisioner: shell...
    default: Running: /var/folders/2b/cvfyxj957y9gffm3xjsgm8640000gn/T/vagrant-shell20151227-4111-1jfbb8j.sh
==> default: nginx stop/waiting
==> default: nginx start/running, process 1837
==> default: php5-fpm: unrecognized service
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
0 likes
19 replies
bashy's avatar

Looks like you're using a new Homestead box version but an old Homestead Vagrantfile I think.

Have you tried updating both?

mmonkey's avatar
mmonkey
Best Answer
Level 2

@xtremer360 try the following:

$ vagrant box remove
$ composer global remove laravel/homestead
$ composer clear-cache
$ composer global require laravel/homestead
$ vagrant up

The vagrant up will take some time because it will have to re-download the homestead box, but this should fetch you the latest version.

2 likes
jrdavidson's avatar

@mmonkey This is what happens.

This command was not invoked properly. The help for this command is
available below.

Usage: vagrant box remove <name>

Options:

    -f, --force                      Destroy without confirmation.
        --provider PROVIDER          The specific provider type for the box to remove
        --box-version VERSION        The specific version of the box to remove
        --all                        Remove all available versions of the box
    -h, --help                       Print this help
saamretep's avatar

You have an issue with the php version as well:

default: php5-fpm: unrecognized service

You can solve this issue as followed:

homestead ssh

cd to /etc/nginx/sites-available

sudo vi [name of your app]

change 

fastcgi_pass unix:/var/run/php5-fpm.sock;  =>  fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

1 like
saamretep's avatar

@bashy Thx, I did try laravel/homestead several times and every time I did get the same issue where it referred to php5 instead of php7.

update: I have found the cause of the php5 issue. I had still an old version of homestead in my root directory which contained an old serve-laravel.sh script referring to php5 instead of php/php7.0

luismec90's avatar

Given you are using the last version of Homestead you have to delete old boxes from this folder .vagrant.d\boxes wich is located in your home directory.

jrdavidson's avatar

For some reason I'm still not able to get this issue resolved.

jrdavidson's avatar

I ran the following commands and not sure what to do now.

me-iMac:backstage me$ vagrant up
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.
me-iMac:backstage me$ vagrant global-status
id       name    provider   state   directory
----------------------------------------------------------------------------------------------
8fbaf39  default virtualbox aborted /Users/me/.composer/vendor/laravel/homestead

The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date. To interact with any of the machines, you can go to
that directory and run Vagrant, or you can use the ID directly
with Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"
jrdavidson's avatar

When you say delete all content from these folders that's just as simple as going in and deleting the directories inside of Finder since I"m on a Mac.

olimaz's avatar

Had the same problem:

==> default: php5-fpm: unrecognized service The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong.

This fixed it: right after the error, the vm is working so try this:

$homestead ssh

once inside the box:

$sudo aptitude install php5-fpm

it will prompt to remove php7.0-fpm, change the php.ini files, and other question whose default answer is correct.

after the changes, ssh out:

$exit

restart the machine:

$homestead halt && homestead up 

and that's it

UPDATE:

mysql client wasn't working, so:

$homestead ssh
$sudo aptitude install php5-mysql

Now I'm guessing wich other php modules will be missing...

Please or to participate in this conversation.