安装 PHP 7.3 on Ubuntu

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.3

查看PHP版本:

php -v 

PHP 7.3.0-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Dec  6 2018 20:24:55) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.0-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

安装 PHP 7.2 on Ubuntu

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.2

查看PHP版本:

php -v 

PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

安装 PHP 7.1 on Ubuntu

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.1

查看PHP版本:

php -v 

PHP 7.1.24-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Nov 12 2018 09:23:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.24-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

安装 PHP 7.0 on Ubuntu

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

查看PHP版本:

php -v 

PHP 7.0.32-4+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Nov  4 2018 05:11:17) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.32-4+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies

作者:霄峰
链接:https://www.jianshu.com/p/1505f30290a5
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

ubuntu18.04 安装 php7.2

sudo apt-get install software-properties-common python-software-properties

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

sudo apt-get -y install php7.2

如果之前有其他版本PHP,在这边禁用掉

sudo a2dismod php5
sudo a2enmod php7.2

安装常用扩展

sudo -y apt-get install php7.2-fpm php7.2-mysql php7.2-curl php7.2-json php7.2-mbstring php7.2-xml  php7.2-intl

安装其他扩展(按需安装)

sudo apt-get install php7.2-gd
sudo apt-get install php7.2-soap
sudo apt-get install php7.2-gmp   
sudo apt-get install php7.2-odbc      
sudo apt-get install php7.2-pspell    
sudo apt-get install php7.2-bcmath  
sudo apt-get install php7.2-enchant   
sudo apt-get install php7.2-imap      
sudo apt-get install php7.2-ldap      
sudo apt-get install php7.2-opcache
sudo apt-get install php7.2-readline  
sudo apt-get install php7.2-sqlite3   
sudo apt-get install php7.2-xmlrpc
sudo apt-get install php7.2-bz2
sudo apt-get install php7.2-interbase
sudo apt-get install php7.2-pgsql     
sudo apt-get install php7.2-recode    
sudo apt-get install php7.2-sybase    
sudo apt-get install php7.2-xsl
sudo apt-get install php7.2-cgi       
sudo apt-get install php7.2-dba
sudo apt-get install php7.2-phpdbg    
sudo apt-get install php7.2-snmp      
sudo apt-get install php7.2-tidy      
sudo apt-get install php7.2-zip

其他

nginx 配置

fastcgi_pass unix:ar/run/php/php7.2-fpm.sock;
文档更新时间: 2019-02-13 09:11   作者:cklx