Ubuntu16.04 安装 PHP7.2

Ubuntu上官方的源

  • 比如 Ubuntu14.04 默认源中的是 PHP5.6.x、Ubuntu16.04 默认源中的是 PHP7.0.x

通过第三方的源来安装

  • ppa:ondrej/php 是一个比较知名的PHP源(目前维护php5.6,php7.0,php7.1,php7.2,php7.3)。下面就用这个源来安装自己想要的PHP版本。

安装步骤

  • 使用ppa增加源
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
  • 查看源中PHP7.2版本
sudo apt list | grep php

不出意外,列表中已经包含你想要的PHP版本了

  • 安装PHP7.2
sudo apt-get -y install php7.2

你可能感兴趣的:(Linux,PHP,Ubuntu)