laravel 如何在 homestead 更新 PHP 版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40101201/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to update PHP version in homestead
提问by claudios
I am having a trouble on updating php version in homestead. When I check the version in homestead ssh
it says it's php version is PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cli)
. Now I would like to update the PHP version to 7 for code compatibility. Is there an easy way how to fix this?
我在 Homestead 更新 php 版本时遇到了麻烦。当我检查其中的版本时,homestead ssh
它说它的 php 版本是PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cli)
. 现在我想将 PHP 版本更新为 7 以实现代码兼容性。有没有简单的方法来解决这个问题?
I also tried this one from herebut got no luck. Thanks
我也从这里尝试过这个, 但没有运气。谢谢
回答by Marek Skiba
You have probably Laravel version 5.0 - https://laravel.com/docs/5.0/homestead, in this version Homestead has Ubuntu 14.04 and PHP 5.6. To update only PHP to 7.0, you need log into the Homestead, and execute:
你可能有 Laravel 5.0 版 - https://laravel.com/docs/5.0/homestead,在这个版本中 Homestead 有 Ubuntu 14.04 和 PHP 5.6。如果只更新 PHP 到 7.0,你需要登录 Homestead,然后执行:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get -y install php7.0-mysql php7.0-fpm php7.0-mbstring php7.0-xml php7.0-curl
Then you need change fastcgi_pass
in you configuration files in /etc/nginx/sites-available/*
to this fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
然后你需要改变fastcgi_pass
你的配置文件/etc/nginx/sites-available/*
到这个fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
and at the end restart services:
最后重启服务:
/etc/init.d/nginx restart
/etc/init.d/php7.0-fpm restart
回答by Yevgeniy Afanasyev
Upgrade the laravel/homestead box itself
升级laravel/homestead box本身
$ vagrant box update
ssh into the virtual machine
ssh 进入虚拟机
$ vagrant ssh
and upgrade everything
并升级一切
$ sudo apt-get update
$ sudo apt-get upgrade