将Laravel Homestead v7.0.1与php 7.2更改为php 7.1 [英] Change Laravel Homestead v7.0.1 with php 7.2 to php 7.1

查看:53
本文介绍了将Laravel Homestead v7.0.1与php 7.2更改为php 7.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将php版本降级到7.1并将其默认设置为最新的Homestead 7的步骤是什么,Homestead 7带有php版本7.2作为默认值.

What are the steps to downgrade the php version to 7.1 and make it default on latest Homestead 7, Homestead 7 comes with php version 7.2 as default.

我的宅基地上有许多开发站点,我希望一切都在7.1上运行默认情况下,如果我需要7.2,那么我将在宅基地Yaml中使用以下内容

There are a number of dev sites on my homestead I want everything to run on 7.1 by default, if I need 7.2 then I will use the following in my homestead yaml

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

推荐答案

我认为我有一个更好的解决方案,要在Homestead中切换php版本(我目前正在使用版本8),并运行以下代码行来切换默认的php版本

I think I have a better solution, to switch the php version in Homestead (I am using version 8 currently) running following lines of code switches the default php version.

sudo update-alternatives --set php /usr/bin/php7.1
sudo update-alternatives --set phar /usr/bin/phar7.1
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.1
sudo update-alternatives --set phpize /usr/bin/phpize7.1
sudo update-alternatives --set php-config /usr/bin/php-config7.1

上一行将把php版本从任何版本切换到7.1版本(默认情况下,Homestead 8附带php 7.3).

Above line will switch the php version from any version to version 7.1 (Homestead 8 comes with php 7.3 by default).

请记住在进行此更改后重新加载Web服务器(apache或nginx).

Do remember to reload web-server (apache or nginx) after making this change.

2020年7月更新:在更新版本的Homestead中,更改php版本的别名为 php71 php72 php73 php74 等即可轻松实现版本之间切换

July 2020 UPDATE: In newer versions of homestead to change php version there are aliases like php71 php72 php73 php74 etc. to easily swith between versions

这篇关于将Laravel Homestead v7.0.1与php 7.2更改为php 7.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆