如何在Vagrant和Homestead中回滚PHP版本? [英] How to roll back PHP version in Vagrant and Homestead?

查看:103
本文介绍了如何在Vagrant和Homestead中回滚PHP版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我的公司正在将PHP与Laravel一起用于客户端的软件开发.我刚接触公司,并使用VirtualBox,使用Homestead的Laravel和Vagrant设置了更新的Macbook.

我已经进行了所有设置,以能够创建本地文件并将它们也绑定到VM,但是无论何时我们尝试使用本地主机打开页面,都会给我们一个错误,即"Laravel需要Mcrypt PHP扩大".

我已将所有内部文件迁移到本地计算机上,以便能够在本地打开它们,但是即使能够在终端中看到它们也无法打开它们.尽管他使用的是PHP和Laravel的旧版本,但在其他开发人员的Macbook上,它仍然可以正常工作.

我的问题(我找不到相关的问题),是否可以安装旧版本的laravel和PHP以强制我的VM项目仅使用PHP 7.0版打开?我发现一些帖子表明PHP 7.1+不再支持mcrypt.

请提供您知道的所有相关信息.昨天和今天,我们整天都在反对这个问题.抱歉,如果该帖子看起来很新手.我只是没有弄清楚.

*** 我们今天想通了.我们不得不将我们的项目强制安装到PHP 7.0中,最后使其正常运行.我们删除了整个Laravel原始安装,并使用此教程重新安装:解决方案

您可以在Homestead.yaml文件中指定PHP版本:

sites:
    - map: homestead.test
      to: /home/vagrant/code/Laravel/public
      php: "7.0"

进行此更改后,您将需要重新配置Homestead:

vagrant reload --provision

请参见文档中的多个PHP版本"部分. >

So, my company is using PHP with Laravel for software development for clients. I am new to the company and setting up a newer Macbook with VirtualBox, Laravel using Homestead, and Vagrant.

I have gotten everything set up to be able to create local files and have them also tie into the VM, but anytime we try to open the pages using our local host, it gives us the error that "Laravel requires the Mcrypt PHP extension".

I have migrated all of our in-house files over to my local machine to be able to open them locally, but I can't get them to open even with being able to see them in the terminal. It works fine on the other developer's Macbook, although he is using an older version of both PHP and Laravel.

My question, which I cannot find a relevant question about, is can I install an older version of laravel and PHP to be able to force my VM project to open only with PHP version 7.0? I found some posts that indicate that mcrypt is no longer supported on PHP 7.1+.

Please include any relevant information you know of. We have been beating our heads against this issue all day yesterday and today. I'm sorry if this post seems noob-ish. I'm just not figuring it out.

***EDIT: We got it figured out today. We had to force our project into PHP 7.0 and finally got it working. We deleted the entire original Laravel installation and reinstalled using this tutorial: https://medium.com/@gdiasdasilva/creating-a-homestead-box-with-php-7-0-aaa72fb0e297

Thank you guys for your responses. Thankfully after two days, we worked our way through the issue. The biggest issue was trying to allow the project, which was created on another machine using a different version of PHP, to open and run on my machine. Not an issue I had seen anywhere before. To be fair, this is my first time ever working with Laravel. I have a background in ASP.NET MVC 5 and this is an adjustment on getting the correct dependencies.

Again, thank you all for your responses!***

解决方案

You can specify the PHP version in the Homestead.yaml file:

sites:
    - map: homestead.test
      to: /home/vagrant/code/Laravel/public
      php: "7.0"

After making this change you will need to re-provision Homestead:

vagrant reload --provision

See the Multiple PHP Versions section from the documentation.

这篇关于如何在Vagrant和Homestead中回滚PHP版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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