Ubuntu apt-get 安装php

直接用官方PPA源

sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update

显示软件安装包列表,是否已经有了PHP 7.1,可选

apt-cache pkgnames | grep php7.1

安装,2018年05月08日 星期二,现在的最新版是7.2

sudo apt-get install php7.4-fpm

安装php 拓展

sudo apt-get install php7.4-mbstring
sudo apt-get install php7.4-bcmath
sudo apt-get install php7.4-mysql
sudo apt-get install php7.4-redis
sudo apt-get install php7.4-gd
sudo apt-get install php7.4-intl
sudo apt-get install php7.4-xml
sudo apt-get install php7.4-zip
sudo apt-get install php7.4-curl

windows10 WLS中Ubuntu 中的bug

需要在nginx http blok 中增加以下配置,否则请求会超时

fastcgi_buffering off;

安装7.0

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php7.0