简体   繁体   English

在 ubuntu 16.04 上将 php 升级到 v 7.2 版本

[英]Upgrade php to v 7.2 version on ubuntu 16.04

I want to upgrade my apache php version on ubuntu 16.04.我想在 ubuntu 16.04 上升级我的 apache php 版本。 Right now phpinfo() shows 7.0.26.现在phpinfo()显示 7.0.26。 How can I upgrade?如何升级?

I want to upgrade to phpversion 7.2.我想升级到 phpversion 7.2。 sudo apt install php7.2 , doesn't update the apache php version. sudo apt install php7.2 ,不会更新 apache php 版本。 How can I update the apache php version.如何更新 apache php 版本。

I'm assuming that you already have apache and php 7.0 installed, and that you're using the Ondřej Surý PPA something like this:我假设您已经安装了 apache 和 php 7.0,并且您正在使用 Ondřej Surý PPA,如下所示:

LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.2

At this point, you would need to remove the old libapache2-mod-php package, install the new one, and restart apache:此时,您需要删除旧的 libapache2-mod-php 包,安装新的包,然后重新启动 apache:

sudo apt remove libapache2-mod-php*
sudo apt update
sudo apt install libapache2-mod-php7.2
sudo service apache2 restart

Now, phpinfo() from within a web page should show PHP Version 7.2.0-2+ubuntu16.04.1+deb.sury.org+2现在,网页中的phpinfo()应该显示PHP Version 7.2.0-2+ubuntu16.04.1+deb.sury.org+2

If the add-apt-repository command is missing, you can install it with:如果缺少add-apt-repository命令,您可以使用以下命令安装它:

sudo apt install software-properties-common


Please run below commands to upgrade your PHP version to 7.2请运行以下命令将您的 PHP 版本升级到 7.2

sudo apt-get update
sudo apt-get install python-software-properties
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get install php7.2
sudo a2dismod php7.0
sudo a2enmod php7.2
sudo update-alternatives --set php /usr/bin/php7.2
sudo service apache2 restart
sudo apt-get install libapache2-mod-php7.2 php7.2-cgi php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-imap php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-pspell php7.2-readline php7.2-soap php7.2-xml
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.2-fpm
sudo service apache2 restart

Hope this helps !!!希望这有帮助!!!

In this way, simply run following order for update php rendition.通过这种方式,只需运行以下更新 php 再现的顺序。

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update


sudo apt install php7.3

Referencelink参考链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM