自升级到Laravel 5.6以来,我的网站不再被Homestead所取代。我想,这是一个PHP版本的问题。与Laravel documentation中的描述不同,我的服务器不是运行PHP 7.2,而是phpversion()显示:
The current PHP version is 7.0.27-1+ubuntu16.04.1+deb.sury.org+1
将php选择器添加到我的Homestead.yaml文件中无效。
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
php: "7.2"
我更新了整个环境,包括Virtual Box,Vagrant等.laravel / homestead与5.1.0版一起安装。如何将系统升级到PHP 7.2?
我用以下输出尝试了vagrant destroy && vagrant up:
$ 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
我不知道我的问题是否与GuestAdditions问题有关。然而,vagrant up: Got different reports about installed GuestAdditions version的解决方案没有帮助。
谢谢你的帮助!
vagrant destroy && vagrant up
如果仍然没有使用7.2发布完整输出,那么我们可以看到可能出错的地方。
那个问题是过时的Homestead版本。克隆存储库并重新启动vagrant解决了它。
git clone https://github.com/laravel/homestead.git ~/Homestead
谢谢你的帮助!