【问题标题】:PHP version set to 7.0 instead of >7.1 in Laravel Homestead-7在 Laravel Homestead-7 中 PHP 版本设置为 7.0 而不是 >7.1
【发布时间】:2018-03-02 17:07:00
【问题描述】:

自从升级到 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的解决方案并没有帮助。

感谢您的帮助!

【问题讨论】:

    标签: php laravel vagrant virtualbox homestead


    【解决方案1】:

    vagrant destroy && vagrant up 如果它仍然没有使用 7.2,请发布完整的输出,以便我们查看可能出了什么问题。

    【讨论】:

    • 我将输出添加到问题中。只是做vagrant destroy && vagrant up 并没有解决它。
    【解决方案2】:

    那个问题是一个过时的 Homestead 版本。 克隆存储库并重新启动 vagrant 解决了它。

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

    感谢您的帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-08
      • 2018-05-30
      • 1970-01-01
      • 2022-10-25
      • 2018-11-10
      • 2014-10-22
      • 2022-01-27
      相关资源
      最近更新 更多