Search code examples
phplaravelvagrantvirtualboxhomestead

PHP version set to 7.0 instead of >7.1 in Laravel Homestead-7


Since upgrading to Laravel 5.6, my websites arent rendered with Homestead anymore. I guess, that this is a PHP version issue. Unlike the descriptions in the Laravel documentation my server is running not with PHP 7.2, instead phpversion() shows:

The current PHP version is 7.0.27-1+ubuntu16.04.1+deb.sury.org+1

Adding php Selectors to my Homestead.yaml file has no effect.

sites:
  - map: homestead.app
    to: /home/vagrant/Code/Laravel/public
    php: "7.2"

I updated the whole environment, including Virtual Box, Vagrant, etc. laravel/homestead is installed with version 5.1.0. How can I upgrade the system to PHP 7.2?

I tried vagrant destroy && vagrant up with the following output:

$ vagrant destroy && vagrant up
    homestead-7: Are you sure you want to destroy the 'homestead-7' VM? [y/N] 
==> homestead-7: Forcing shutdown of VM...
==> homestead-7: Destroying VM and associated drives...
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Importing base box 'laravel/homestead'...
==> homestead-7: Matching MAC address for NAT networking...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Setting the name of the VM: homestead-7
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
    homestead-7: Adapter 1: nat
    homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
    homestead-7: 80 (guest) => 8000 (host) (adapter 1)
    homestead-7: 443 (guest) => 44300 (host) (adapter 1)
    homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
    homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
    homestead-7: 22 (guest) => 2222 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
    homestead-7: SSH address: 127.0.0.1:2222
    homestead-7: SSH username: vagrant
    homestead-7: SSH auth method: private key
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Connection aborted. Retrying...
(...)
    homestead-7: Vagrant insecure key detected. Vagrant will automatically replace
    homestead-7: this with a newly generated keypair for better security.
    homestead-7:
    homestead-7: Inserting generated public key within guest...
    homestead-7: Removing insecure key from the guest if it's present...
    homestead-7: Key inserted! Disconnecting and reconnecting using new SSH key...
==> homestead-7: Machine booted and ready!

Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.18
VBoxService inside the vm claims: 5.2.4
Going on, assuming VBoxService is correct...
[homestead-7] GuestAdditions versions on your host (5.2.8) and guest (5.2.4) do not match.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.18
VBoxService inside the vm claims: 5.2.4
Going on, assuming VBoxService is correct...
Reading package lists...
Building dependency tree...
Reading state information...
dkms is already the newest version (2.2.0.3-2ubuntu11.5).
linux-headers-4.4.0-112-generic is already the newest version (4.4.0-112.135).
linux-headers-4.4.0-112-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Copy iso file C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso
into the box /tmp/VBoxGuestAdditions.iso

I have no idea whether my problem is connected to the GuestAdditions issue. However, the solution of vagrant up: Got different reports about installed GuestAdditions version did not help.

Thx for your help!


Solution

  • That problem was an outdated Homestead version. Cloning the repository and restarting vagrant solved it.

    git clone https://github.com/laravel/homestead.git ~/Homestead
    

    Thanks for your help!