laravel 如何将 php 7.0 更新到 php 7.1+ ubuntu
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48892141/
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 7.0 to php 7.1+ ubuntu
提问by Billy Joe
I have seen some help on this online but for other distros. Before I screw something up, I would love some help on this for my exact setup which is below. This will ultimately be for upgrading Laravel to 5.6 which needs newer php version.
我在网上看到了一些帮助,但对于其他发行版。在我搞砸之前,我希望在这方面为我的确切设置提供一些帮助,如下所示。这最终将用于将 Laravel 升级到需要更新 php 版本的 5.6。
Ubuntu LTS, MariaDB, nginx, Laravel 5.5, AWS EC2 instance
Ubuntu LTS、MariaDB、nginx、Laravel 5.5、AWS EC2 实例
回答by Adam Kozlowski
Use terminal and download repo:
使用终端并下载 repo:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
Then install:
然后安装:
service apache2 stop
sudo apt-get install php7.1 php7.1-common
Start using php 7.1:
开始使用 php 7.1:
a2enmod php7.1
service apache2 restart
Check version:
检查版本:
php -v
More for apache : https://jakelprice.com/article/how-to-upgrade-from-php-70-to-php-71
apache 的更多信息:https: //jakelprice.com/article/how-to-upgrade-from-php-70-to-php-71
More for NGINX: https://www.howtoforge.com/tutorial/installing-nginx-with-php7-fpm-and-mysql-on-ubuntu-16.04-lts-lemp/
更多 NGINX:https://www.howtoforge.com/tutorial/installing-nginx-with-php7-fpm-and-mysql-on-ubuntu-16.04-lts-lemp/
回答by ownking
I was also wondering how to update to the latest 7.1.* version. I had PHP 7.1.7 but for Symfony 4 I need >=7.1.8. I coudn't find an explanation how to updated. Finally I check how I installed the latest version:
我还想知道如何更新到最新的 7.1.* 版本。我有 PHP 7.1.7 但对于 Symfony 4 我需要 >=7.1.8。我找不到如何更新的解释。最后我检查一下我是如何安装最新版本的:
apt-get install php7.1-curl php7.1-dev php7.1-zip php7.1-fpm php7.1-gd php7.1-xml php7.1-mysql php7.1-mcrypt php7.1-mbstring php7.1-opcach
As there is no minor vesion, I thought I try the same command again. And bingo, it did the update to the lasted minor verion: 7.1.22.
由于没有小版本,我想我再次尝试相同的命令。和宾果游戏,它对持续的次要版本进行了更新:7.1.22。
回答by Florin Marin
Use Vagrant + Docker You can use Vagrant + Docker to replicate your environment except for PHP which will be 7.1 and see if the app is still working :)
Use static analysis tools Before you start you can also use some static analysis tools to check for deprecated code: https://github.com/exakat/php-static-analysis-tools
Check offical PHP documentation http://php.net/manual/en/migration71.php
使用 Vagrant + Docker 你可以使用 Vagrant + Docker 来复制你的环境,除了 PHP 将是 7.1,看看应用程序是否仍在工作:)
使用静态分析工具 在开始之前,您还可以使用一些静态分析工具来检查过时的代码:https: //github.com/exakat/php-static-analysis-tools
检查官方 PHP 文档 http://php.net/manual/en/migration71.php